
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ida_search_core.h"


void
rotate_222(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[3];
        cube[2] = cube_tmp[1];
        cube[3] = cube_tmp[4];
        cube[4] = cube_tmp[2];
        cube[5] = cube_tmp[9];
        cube[6] = cube_tmp[10];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[14];
        cube[13] = cube_tmp[17];
        cube[14] = cube_tmp[18];
        cube[17] = cube_tmp[5];
        cube[18] = cube_tmp[6];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[2];
        cube[2] = cube_tmp[4];
        cube[3] = cube_tmp[1];
        cube[4] = cube_tmp[3];
        cube[5] = cube_tmp[17];
        cube[6] = cube_tmp[18];
        cube[9] = cube_tmp[5];
        cube[10] = cube_tmp[6];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[10];
        cube[17] = cube_tmp[13];
        cube[18] = cube_tmp[14];
        break;

    case U2:
        cube[1] = cube_tmp[4];
        cube[2] = cube_tmp[3];
        cube[3] = cube_tmp[2];
        cube[4] = cube_tmp[1];
        cube[5] = cube_tmp[13];
        cube[6] = cube_tmp[14];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[18];
        cube[13] = cube_tmp[5];
        cube[14] = cube_tmp[6];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[10];
        break;

    case L:
        cube[1] = cube_tmp[20];
        cube[3] = cube_tmp[18];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[5];
        cube[7] = cube_tmp[8];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[1];
        cube[11] = cube_tmp[3];
        cube[18] = cube_tmp[23];
        cube[20] = cube_tmp[21];
        cube[21] = cube_tmp[9];
        cube[23] = cube_tmp[11];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[9];
        cube[3] = cube_tmp[11];
        cube[5] = cube_tmp[6];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[7];
        cube[9] = cube_tmp[21];
        cube[11] = cube_tmp[23];
        cube[18] = cube_tmp[3];
        cube[20] = cube_tmp[1];
        cube[21] = cube_tmp[20];
        cube[23] = cube_tmp[18];
        break;

    case L2:
        cube[1] = cube_tmp[21];
        cube[3] = cube_tmp[23];
        cube[5] = cube_tmp[8];
        cube[6] = cube_tmp[7];
        cube[7] = cube_tmp[6];
        cube[8] = cube_tmp[5];
        cube[9] = cube_tmp[20];
        cube[11] = cube_tmp[18];
        cube[18] = cube_tmp[11];
        cube[20] = cube_tmp[9];
        cube[21] = cube_tmp[1];
        cube[23] = cube_tmp[3];
        break;

    case F:
        cube[3] = cube_tmp[8];
        cube[4] = cube_tmp[6];
        cube[6] = cube_tmp[21];
        cube[8] = cube_tmp[22];
        cube[9] = cube_tmp[11];
        cube[10] = cube_tmp[9];
        cube[11] = cube_tmp[12];
        cube[12] = cube_tmp[10];
        cube[13] = cube_tmp[3];
        cube[15] = cube_tmp[4];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[13];
        break;

    case F_PRIME:
        cube[3] = cube_tmp[13];
        cube[4] = cube_tmp[15];
        cube[6] = cube_tmp[4];
        cube[8] = cube_tmp[3];
        cube[9] = cube_tmp[10];
        cube[10] = cube_tmp[12];
        cube[11] = cube_tmp[9];
        cube[12] = cube_tmp[11];
        cube[13] = cube_tmp[22];
        cube[15] = cube_tmp[21];
        cube[21] = cube_tmp[6];
        cube[22] = cube_tmp[8];
        break;

    case F2:
        cube[3] = cube_tmp[22];
        cube[4] = cube_tmp[21];
        cube[6] = cube_tmp[15];
        cube[8] = cube_tmp[13];
        cube[9] = cube_tmp[12];
        cube[10] = cube_tmp[11];
        cube[11] = cube_tmp[10];
        cube[12] = cube_tmp[9];
        cube[13] = cube_tmp[8];
        cube[15] = cube_tmp[6];
        cube[21] = cube_tmp[4];
        cube[22] = cube_tmp[3];
        break;

    case R:
        cube[2] = cube_tmp[10];
        cube[4] = cube_tmp[12];
        cube[10] = cube_tmp[22];
        cube[12] = cube_tmp[24];
        cube[13] = cube_tmp[15];
        cube[14] = cube_tmp[13];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[14];
        cube[17] = cube_tmp[4];
        cube[19] = cube_tmp[2];
        cube[22] = cube_tmp[19];
        cube[24] = cube_tmp[17];
        break;

    case R_PRIME:
        cube[2] = cube_tmp[19];
        cube[4] = cube_tmp[17];
        cube[10] = cube_tmp[2];
        cube[12] = cube_tmp[4];
        cube[13] = cube_tmp[14];
        cube[14] = cube_tmp[16];
        cube[15] = cube_tmp[13];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[24];
        cube[19] = cube_tmp[22];
        cube[22] = cube_tmp[10];
        cube[24] = cube_tmp[12];
        break;

    case R2:
        cube[2] = cube_tmp[22];
        cube[4] = cube_tmp[24];
        cube[10] = cube_tmp[19];
        cube[12] = cube_tmp[17];
        cube[13] = cube_tmp[16];
        cube[14] = cube_tmp[15];
        cube[15] = cube_tmp[14];
        cube[16] = cube_tmp[13];
        cube[17] = cube_tmp[12];
        cube[19] = cube_tmp[10];
        cube[22] = cube_tmp[2];
        cube[24] = cube_tmp[4];
        break;

    case B:
        cube[1] = cube_tmp[14];
        cube[2] = cube_tmp[16];
        cube[5] = cube_tmp[2];
        cube[7] = cube_tmp[1];
        cube[14] = cube_tmp[24];
        cube[16] = cube_tmp[23];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[17];
        cube[19] = cube_tmp[20];
        cube[20] = cube_tmp[18];
        cube[23] = cube_tmp[5];
        cube[24] = cube_tmp[7];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[5];
        cube[5] = cube_tmp[23];
        cube[7] = cube_tmp[24];
        cube[14] = cube_tmp[1];
        cube[16] = cube_tmp[2];
        cube[17] = cube_tmp[18];
        cube[18] = cube_tmp[20];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[19];
        cube[23] = cube_tmp[16];
        cube[24] = cube_tmp[14];
        break;

    case B2:
        cube[1] = cube_tmp[24];
        cube[2] = cube_tmp[23];
        cube[5] = cube_tmp[16];
        cube[7] = cube_tmp[14];
        cube[14] = cube_tmp[7];
        cube[16] = cube_tmp[5];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[19];
        cube[19] = cube_tmp[18];
        cube[20] = cube_tmp[17];
        cube[23] = cube_tmp[2];
        cube[24] = cube_tmp[1];
        break;

    case D:
        cube[7] = cube_tmp[19];
        cube[8] = cube_tmp[20];
        cube[11] = cube_tmp[7];
        cube[12] = cube_tmp[8];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[12];
        cube[19] = cube_tmp[15];
        cube[20] = cube_tmp[16];
        cube[21] = cube_tmp[23];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[24];
        cube[24] = cube_tmp[22];
        break;

    case D_PRIME:
        cube[7] = cube_tmp[11];
        cube[8] = cube_tmp[12];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[16];
        cube[15] = cube_tmp[19];
        cube[16] = cube_tmp[20];
        cube[19] = cube_tmp[7];
        cube[20] = cube_tmp[8];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[24];
        cube[23] = cube_tmp[21];
        cube[24] = cube_tmp[23];
        break;

    case D2:
        cube[7] = cube_tmp[15];
        cube[8] = cube_tmp[16];
        cube[11] = cube_tmp[19];
        cube[12] = cube_tmp[20];
        cube[15] = cube_tmp[7];
        cube[16] = cube_tmp[8];
        cube[19] = cube_tmp[11];
        cube[20] = cube_tmp[12];
        cube[21] = cube_tmp[24];
        cube[22] = cube_tmp[23];
        cube[23] = cube_tmp[22];
        cube[24] = cube_tmp[21];
        break;

    case X:
        cube[1] = cube_tmp[9];
        cube[2] = cube_tmp[10];
        cube[3] = cube_tmp[11];
        cube[4] = cube_tmp[12];
        cube[5] = cube_tmp[6];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[7];
        cube[9] = cube_tmp[21];
        cube[10] = cube_tmp[22];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[24];
        cube[13] = cube_tmp[15];
        cube[14] = cube_tmp[13];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[14];
        cube[17] = cube_tmp[4];
        cube[18] = cube_tmp[3];
        cube[19] = cube_tmp[2];
        cube[20] = cube_tmp[1];
        cube[21] = cube_tmp[20];
        cube[22] = cube_tmp[19];
        cube[23] = cube_tmp[18];
        cube[24] = cube_tmp[17];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[20];
        cube[2] = cube_tmp[19];
        cube[3] = cube_tmp[18];
        cube[4] = cube_tmp[17];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[5];
        cube[7] = cube_tmp[8];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[1];
        cube[10] = cube_tmp[2];
        cube[11] = cube_tmp[3];
        cube[12] = cube_tmp[4];
        cube[13] = cube_tmp[14];
        cube[14] = cube_tmp[16];
        cube[15] = cube_tmp[13];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[24];
        cube[18] = cube_tmp[23];
        cube[19] = cube_tmp[22];
        cube[20] = cube_tmp[21];
        cube[21] = cube_tmp[9];
        cube[22] = cube_tmp[10];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[12];
        break;

    case Y:
        cube[1] = cube_tmp[3];
        cube[2] = cube_tmp[1];
        cube[3] = cube_tmp[4];
        cube[4] = cube_tmp[2];
        cube[5] = cube_tmp[9];
        cube[6] = cube_tmp[10];
        cube[7] = cube_tmp[11];
        cube[8] = cube_tmp[12];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[14];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[17];
        cube[14] = cube_tmp[18];
        cube[15] = cube_tmp[19];
        cube[16] = cube_tmp[20];
        cube[17] = cube_tmp[5];
        cube[18] = cube_tmp[6];
        cube[19] = cube_tmp[7];
        cube[20] = cube_tmp[8];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[24];
        cube[23] = cube_tmp[21];
        cube[24] = cube_tmp[23];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[2];
        cube[2] = cube_tmp[4];
        cube[3] = cube_tmp[1];
        cube[4] = cube_tmp[3];
        cube[5] = cube_tmp[17];
        cube[6] = cube_tmp[18];
        cube[7] = cube_tmp[19];
        cube[8] = cube_tmp[20];
        cube[9] = cube_tmp[5];
        cube[10] = cube_tmp[6];
        cube[11] = cube_tmp[7];
        cube[12] = cube_tmp[8];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[10];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[13];
        cube[18] = cube_tmp[14];
        cube[19] = cube_tmp[15];
        cube[20] = cube_tmp[16];
        cube[21] = cube_tmp[23];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[24];
        cube[24] = cube_tmp[22];
        break;

    case Z:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[5];
        cube[3] = cube_tmp[8];
        cube[4] = cube_tmp[6];
        cube[5] = cube_tmp[23];
        cube[6] = cube_tmp[21];
        cube[7] = cube_tmp[24];
        cube[8] = cube_tmp[22];
        cube[9] = cube_tmp[11];
        cube[10] = cube_tmp[9];
        cube[11] = cube_tmp[12];
        cube[12] = cube_tmp[10];
        cube[13] = cube_tmp[3];
        cube[14] = cube_tmp[1];
        cube[15] = cube_tmp[4];
        cube[16] = cube_tmp[2];
        cube[17] = cube_tmp[18];
        cube[18] = cube_tmp[20];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[19];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[13];
        cube[23] = cube_tmp[16];
        cube[24] = cube_tmp[14];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[14];
        cube[2] = cube_tmp[16];
        cube[3] = cube_tmp[13];
        cube[4] = cube_tmp[15];
        cube[5] = cube_tmp[2];
        cube[6] = cube_tmp[4];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[3];
        cube[9] = cube_tmp[10];
        cube[10] = cube_tmp[12];
        cube[11] = cube_tmp[9];
        cube[12] = cube_tmp[11];
        cube[13] = cube_tmp[22];
        cube[14] = cube_tmp[24];
        cube[15] = cube_tmp[21];
        cube[16] = cube_tmp[23];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[17];
        cube[19] = cube_tmp[20];
        cube[20] = cube_tmp[18];
        cube[21] = cube_tmp[6];
        cube[22] = cube_tmp[8];
        cube[23] = cube_tmp[5];
        cube[24] = cube_tmp[7];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

void
rotate_333(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[4];
        cube[3] = cube_tmp[1];
        cube[4] = cube_tmp[8];
        cube[6] = cube_tmp[2];
        cube[7] = cube_tmp[9];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[3];
        cube[10] = cube_tmp[19];
        cube[11] = cube_tmp[20];
        cube[12] = cube_tmp[21];
        cube[19] = cube_tmp[28];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[30];
        cube[28] = cube_tmp[37];
        cube[29] = cube_tmp[38];
        cube[30] = cube_tmp[39];
        cube[37] = cube_tmp[10];
        cube[38] = cube_tmp[11];
        cube[39] = cube_tmp[12];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[3];
        cube[2] = cube_tmp[6];
        cube[3] = cube_tmp[9];
        cube[4] = cube_tmp[2];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[4];
        cube[9] = cube_tmp[7];
        cube[10] = cube_tmp[37];
        cube[11] = cube_tmp[38];
        cube[12] = cube_tmp[39];
        cube[19] = cube_tmp[10];
        cube[20] = cube_tmp[11];
        cube[21] = cube_tmp[12];
        cube[28] = cube_tmp[19];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[21];
        cube[37] = cube_tmp[28];
        cube[38] = cube_tmp[29];
        cube[39] = cube_tmp[30];
        break;

    case U2:
        cube[1] = cube_tmp[9];
        cube[2] = cube_tmp[8];
        cube[3] = cube_tmp[7];
        cube[4] = cube_tmp[6];
        cube[6] = cube_tmp[4];
        cube[7] = cube_tmp[3];
        cube[8] = cube_tmp[2];
        cube[9] = cube_tmp[1];
        cube[10] = cube_tmp[28];
        cube[11] = cube_tmp[29];
        cube[12] = cube_tmp[30];
        cube[19] = cube_tmp[37];
        cube[20] = cube_tmp[38];
        cube[21] = cube_tmp[39];
        cube[28] = cube_tmp[10];
        cube[29] = cube_tmp[11];
        cube[30] = cube_tmp[12];
        cube[37] = cube_tmp[19];
        cube[38] = cube_tmp[20];
        cube[39] = cube_tmp[21];
        break;

    case L:
        cube[1] = cube_tmp[45];
        cube[4] = cube_tmp[42];
        cube[7] = cube_tmp[39];
        cube[10] = cube_tmp[16];
        cube[11] = cube_tmp[13];
        cube[12] = cube_tmp[10];
        cube[13] = cube_tmp[17];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[18];
        cube[17] = cube_tmp[15];
        cube[18] = cube_tmp[12];
        cube[19] = cube_tmp[1];
        cube[22] = cube_tmp[4];
        cube[25] = cube_tmp[7];
        cube[39] = cube_tmp[52];
        cube[42] = cube_tmp[49];
        cube[45] = cube_tmp[46];
        cube[46] = cube_tmp[19];
        cube[49] = cube_tmp[22];
        cube[52] = cube_tmp[25];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[19];
        cube[4] = cube_tmp[22];
        cube[7] = cube_tmp[25];
        cube[10] = cube_tmp[12];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[18];
        cube[13] = cube_tmp[11];
        cube[15] = cube_tmp[17];
        cube[16] = cube_tmp[10];
        cube[17] = cube_tmp[13];
        cube[18] = cube_tmp[16];
        cube[19] = cube_tmp[46];
        cube[22] = cube_tmp[49];
        cube[25] = cube_tmp[52];
        cube[39] = cube_tmp[7];
        cube[42] = cube_tmp[4];
        cube[45] = cube_tmp[1];
        cube[46] = cube_tmp[45];
        cube[49] = cube_tmp[42];
        cube[52] = cube_tmp[39];
        break;

    case L2:
        cube[1] = cube_tmp[46];
        cube[4] = cube_tmp[49];
        cube[7] = cube_tmp[52];
        cube[10] = cube_tmp[18];
        cube[11] = cube_tmp[17];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[15];
        cube[15] = cube_tmp[13];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[11];
        cube[18] = cube_tmp[10];
        cube[19] = cube_tmp[45];
        cube[22] = cube_tmp[42];
        cube[25] = cube_tmp[39];
        cube[39] = cube_tmp[25];
        cube[42] = cube_tmp[22];
        cube[45] = cube_tmp[19];
        cube[46] = cube_tmp[1];
        cube[49] = cube_tmp[4];
        cube[52] = cube_tmp[7];
        break;

    case F:
        cube[7] = cube_tmp[18];
        cube[8] = cube_tmp[15];
        cube[9] = cube_tmp[12];
        cube[12] = cube_tmp[46];
        cube[15] = cube_tmp[47];
        cube[18] = cube_tmp[48];
        cube[19] = cube_tmp[25];
        cube[20] = cube_tmp[22];
        cube[21] = cube_tmp[19];
        cube[22] = cube_tmp[26];
        cube[24] = cube_tmp[20];
        cube[25] = cube_tmp[27];
        cube[26] = cube_tmp[24];
        cube[27] = cube_tmp[21];
        cube[28] = cube_tmp[7];
        cube[31] = cube_tmp[8];
        cube[34] = cube_tmp[9];
        cube[46] = cube_tmp[34];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[28];
        break;

    case F_PRIME:
        cube[7] = cube_tmp[28];
        cube[8] = cube_tmp[31];
        cube[9] = cube_tmp[34];
        cube[12] = cube_tmp[9];
        cube[15] = cube_tmp[8];
        cube[18] = cube_tmp[7];
        cube[19] = cube_tmp[21];
        cube[20] = cube_tmp[24];
        cube[21] = cube_tmp[27];
        cube[22] = cube_tmp[20];
        cube[24] = cube_tmp[26];
        cube[25] = cube_tmp[19];
        cube[26] = cube_tmp[22];
        cube[27] = cube_tmp[25];
        cube[28] = cube_tmp[48];
        cube[31] = cube_tmp[47];
        cube[34] = cube_tmp[46];
        cube[46] = cube_tmp[12];
        cube[47] = cube_tmp[15];
        cube[48] = cube_tmp[18];
        break;

    case F2:
        cube[7] = cube_tmp[48];
        cube[8] = cube_tmp[47];
        cube[9] = cube_tmp[46];
        cube[12] = cube_tmp[34];
        cube[15] = cube_tmp[31];
        cube[18] = cube_tmp[28];
        cube[19] = cube_tmp[27];
        cube[20] = cube_tmp[26];
        cube[21] = cube_tmp[25];
        cube[22] = cube_tmp[24];
        cube[24] = cube_tmp[22];
        cube[25] = cube_tmp[21];
        cube[26] = cube_tmp[20];
        cube[27] = cube_tmp[19];
        cube[28] = cube_tmp[18];
        cube[31] = cube_tmp[15];
        cube[34] = cube_tmp[12];
        cube[46] = cube_tmp[9];
        cube[47] = cube_tmp[8];
        cube[48] = cube_tmp[7];
        break;

    case R:
        cube[3] = cube_tmp[21];
        cube[6] = cube_tmp[24];
        cube[9] = cube_tmp[27];
        cube[21] = cube_tmp[48];
        cube[24] = cube_tmp[51];
        cube[27] = cube_tmp[54];
        cube[28] = cube_tmp[34];
        cube[29] = cube_tmp[31];
        cube[30] = cube_tmp[28];
        cube[31] = cube_tmp[35];
        cube[33] = cube_tmp[29];
        cube[34] = cube_tmp[36];
        cube[35] = cube_tmp[33];
        cube[36] = cube_tmp[30];
        cube[37] = cube_tmp[9];
        cube[40] = cube_tmp[6];
        cube[43] = cube_tmp[3];
        cube[48] = cube_tmp[43];
        cube[51] = cube_tmp[40];
        cube[54] = cube_tmp[37];
        break;

    case R_PRIME:
        cube[3] = cube_tmp[43];
        cube[6] = cube_tmp[40];
        cube[9] = cube_tmp[37];
        cube[21] = cube_tmp[3];
        cube[24] = cube_tmp[6];
        cube[27] = cube_tmp[9];
        cube[28] = cube_tmp[30];
        cube[29] = cube_tmp[33];
        cube[30] = cube_tmp[36];
        cube[31] = cube_tmp[29];
        cube[33] = cube_tmp[35];
        cube[34] = cube_tmp[28];
        cube[35] = cube_tmp[31];
        cube[36] = cube_tmp[34];
        cube[37] = cube_tmp[54];
        cube[40] = cube_tmp[51];
        cube[43] = cube_tmp[48];
        cube[48] = cube_tmp[21];
        cube[51] = cube_tmp[24];
        cube[54] = cube_tmp[27];
        break;

    case R2:
        cube[3] = cube_tmp[48];
        cube[6] = cube_tmp[51];
        cube[9] = cube_tmp[54];
        cube[21] = cube_tmp[43];
        cube[24] = cube_tmp[40];
        cube[27] = cube_tmp[37];
        cube[28] = cube_tmp[36];
        cube[29] = cube_tmp[35];
        cube[30] = cube_tmp[34];
        cube[31] = cube_tmp[33];
        cube[33] = cube_tmp[31];
        cube[34] = cube_tmp[30];
        cube[35] = cube_tmp[29];
        cube[36] = cube_tmp[28];
        cube[37] = cube_tmp[27];
        cube[40] = cube_tmp[24];
        cube[43] = cube_tmp[21];
        cube[48] = cube_tmp[3];
        cube[51] = cube_tmp[6];
        cube[54] = cube_tmp[9];
        break;

    case B:
        cube[1] = cube_tmp[30];
        cube[2] = cube_tmp[33];
        cube[3] = cube_tmp[36];
        cube[10] = cube_tmp[3];
        cube[13] = cube_tmp[2];
        cube[16] = cube_tmp[1];
        cube[30] = cube_tmp[54];
        cube[33] = cube_tmp[53];
        cube[36] = cube_tmp[52];
        cube[37] = cube_tmp[43];
        cube[38] = cube_tmp[40];
        cube[39] = cube_tmp[37];
        cube[40] = cube_tmp[44];
        cube[42] = cube_tmp[38];
        cube[43] = cube_tmp[45];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[39];
        cube[52] = cube_tmp[10];
        cube[53] = cube_tmp[13];
        cube[54] = cube_tmp[16];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[16];
        cube[2] = cube_tmp[13];
        cube[3] = cube_tmp[10];
        cube[10] = cube_tmp[52];
        cube[13] = cube_tmp[53];
        cube[16] = cube_tmp[54];
        cube[30] = cube_tmp[1];
        cube[33] = cube_tmp[2];
        cube[36] = cube_tmp[3];
        cube[37] = cube_tmp[39];
        cube[38] = cube_tmp[42];
        cube[39] = cube_tmp[45];
        cube[40] = cube_tmp[38];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[37];
        cube[44] = cube_tmp[40];
        cube[45] = cube_tmp[43];
        cube[52] = cube_tmp[36];
        cube[53] = cube_tmp[33];
        cube[54] = cube_tmp[30];
        break;

    case B2:
        cube[1] = cube_tmp[54];
        cube[2] = cube_tmp[53];
        cube[3] = cube_tmp[52];
        cube[10] = cube_tmp[36];
        cube[13] = cube_tmp[33];
        cube[16] = cube_tmp[30];
        cube[30] = cube_tmp[16];
        cube[33] = cube_tmp[13];
        cube[36] = cube_tmp[10];
        cube[37] = cube_tmp[45];
        cube[38] = cube_tmp[44];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[42];
        cube[42] = cube_tmp[40];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[38];
        cube[45] = cube_tmp[37];
        cube[52] = cube_tmp[3];
        cube[53] = cube_tmp[2];
        cube[54] = cube_tmp[1];
        break;

    case D:
        cube[16] = cube_tmp[43];
        cube[17] = cube_tmp[44];
        cube[18] = cube_tmp[45];
        cube[25] = cube_tmp[16];
        cube[26] = cube_tmp[17];
        cube[27] = cube_tmp[18];
        cube[34] = cube_tmp[25];
        cube[35] = cube_tmp[26];
        cube[36] = cube_tmp[27];
        cube[43] = cube_tmp[34];
        cube[44] = cube_tmp[35];
        cube[45] = cube_tmp[36];
        cube[46] = cube_tmp[52];
        cube[47] = cube_tmp[49];
        cube[48] = cube_tmp[46];
        cube[49] = cube_tmp[53];
        cube[51] = cube_tmp[47];
        cube[52] = cube_tmp[54];
        cube[53] = cube_tmp[51];
        cube[54] = cube_tmp[48];
        break;

    case D_PRIME:
        cube[16] = cube_tmp[25];
        cube[17] = cube_tmp[26];
        cube[18] = cube_tmp[27];
        cube[25] = cube_tmp[34];
        cube[26] = cube_tmp[35];
        cube[27] = cube_tmp[36];
        cube[34] = cube_tmp[43];
        cube[35] = cube_tmp[44];
        cube[36] = cube_tmp[45];
        cube[43] = cube_tmp[16];
        cube[44] = cube_tmp[17];
        cube[45] = cube_tmp[18];
        cube[46] = cube_tmp[48];
        cube[47] = cube_tmp[51];
        cube[48] = cube_tmp[54];
        cube[49] = cube_tmp[47];
        cube[51] = cube_tmp[53];
        cube[52] = cube_tmp[46];
        cube[53] = cube_tmp[49];
        cube[54] = cube_tmp[52];
        break;

    case D2:
        cube[16] = cube_tmp[34];
        cube[17] = cube_tmp[35];
        cube[18] = cube_tmp[36];
        cube[25] = cube_tmp[43];
        cube[26] = cube_tmp[44];
        cube[27] = cube_tmp[45];
        cube[34] = cube_tmp[16];
        cube[35] = cube_tmp[17];
        cube[36] = cube_tmp[18];
        cube[43] = cube_tmp[25];
        cube[44] = cube_tmp[26];
        cube[45] = cube_tmp[27];
        cube[46] = cube_tmp[54];
        cube[47] = cube_tmp[53];
        cube[48] = cube_tmp[52];
        cube[49] = cube_tmp[51];
        cube[51] = cube_tmp[49];
        cube[52] = cube_tmp[48];
        cube[53] = cube_tmp[47];
        cube[54] = cube_tmp[46];
        break;

    case X:
        cube[1] = cube_tmp[19];
        cube[2] = cube_tmp[20];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[23];
        cube[6] = cube_tmp[24];
        cube[7] = cube_tmp[25];
        cube[8] = cube_tmp[26];
        cube[9] = cube_tmp[27];
        cube[10] = cube_tmp[12];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[18];
        cube[13] = cube_tmp[11];
        cube[15] = cube_tmp[17];
        cube[16] = cube_tmp[10];
        cube[17] = cube_tmp[13];
        cube[18] = cube_tmp[16];
        cube[19] = cube_tmp[46];
        cube[20] = cube_tmp[47];
        cube[21] = cube_tmp[48];
        cube[22] = cube_tmp[49];
        cube[23] = cube_tmp[50];
        cube[24] = cube_tmp[51];
        cube[25] = cube_tmp[52];
        cube[26] = cube_tmp[53];
        cube[27] = cube_tmp[54];
        cube[28] = cube_tmp[34];
        cube[29] = cube_tmp[31];
        cube[30] = cube_tmp[28];
        cube[31] = cube_tmp[35];
        cube[33] = cube_tmp[29];
        cube[34] = cube_tmp[36];
        cube[35] = cube_tmp[33];
        cube[36] = cube_tmp[30];
        cube[37] = cube_tmp[9];
        cube[38] = cube_tmp[8];
        cube[39] = cube_tmp[7];
        cube[40] = cube_tmp[6];
        cube[41] = cube_tmp[5];
        cube[42] = cube_tmp[4];
        cube[43] = cube_tmp[3];
        cube[44] = cube_tmp[2];
        cube[45] = cube_tmp[1];
        cube[46] = cube_tmp[45];
        cube[47] = cube_tmp[44];
        cube[48] = cube_tmp[43];
        cube[49] = cube_tmp[42];
        cube[50] = cube_tmp[41];
        cube[51] = cube_tmp[40];
        cube[52] = cube_tmp[39];
        cube[53] = cube_tmp[38];
        cube[54] = cube_tmp[37];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[45];
        cube[2] = cube_tmp[44];
        cube[3] = cube_tmp[43];
        cube[4] = cube_tmp[42];
        cube[5] = cube_tmp[41];
        cube[6] = cube_tmp[40];
        cube[7] = cube_tmp[39];
        cube[8] = cube_tmp[38];
        cube[9] = cube_tmp[37];
        cube[10] = cube_tmp[16];
        cube[11] = cube_tmp[13];
        cube[12] = cube_tmp[10];
        cube[13] = cube_tmp[17];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[18];
        cube[17] = cube_tmp[15];
        cube[18] = cube_tmp[12];
        cube[19] = cube_tmp[1];
        cube[20] = cube_tmp[2];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[5];
        cube[24] = cube_tmp[6];
        cube[25] = cube_tmp[7];
        cube[26] = cube_tmp[8];
        cube[27] = cube_tmp[9];
        cube[28] = cube_tmp[30];
        cube[29] = cube_tmp[33];
        cube[30] = cube_tmp[36];
        cube[31] = cube_tmp[29];
        cube[33] = cube_tmp[35];
        cube[34] = cube_tmp[28];
        cube[35] = cube_tmp[31];
        cube[36] = cube_tmp[34];
        cube[37] = cube_tmp[54];
        cube[38] = cube_tmp[53];
        cube[39] = cube_tmp[52];
        cube[40] = cube_tmp[51];
        cube[41] = cube_tmp[50];
        cube[42] = cube_tmp[49];
        cube[43] = cube_tmp[48];
        cube[44] = cube_tmp[47];
        cube[45] = cube_tmp[46];
        cube[46] = cube_tmp[19];
        cube[47] = cube_tmp[20];
        cube[48] = cube_tmp[21];
        cube[49] = cube_tmp[22];
        cube[50] = cube_tmp[23];
        cube[51] = cube_tmp[24];
        cube[52] = cube_tmp[25];
        cube[53] = cube_tmp[26];
        cube[54] = cube_tmp[27];
        break;

    case Y:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[4];
        cube[3] = cube_tmp[1];
        cube[4] = cube_tmp[8];
        cube[6] = cube_tmp[2];
        cube[7] = cube_tmp[9];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[3];
        cube[10] = cube_tmp[19];
        cube[11] = cube_tmp[20];
        cube[12] = cube_tmp[21];
        cube[13] = cube_tmp[22];
        cube[14] = cube_tmp[23];
        cube[15] = cube_tmp[24];
        cube[16] = cube_tmp[25];
        cube[17] = cube_tmp[26];
        cube[18] = cube_tmp[27];
        cube[19] = cube_tmp[28];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[30];
        cube[22] = cube_tmp[31];
        cube[23] = cube_tmp[32];
        cube[24] = cube_tmp[33];
        cube[25] = cube_tmp[34];
        cube[26] = cube_tmp[35];
        cube[27] = cube_tmp[36];
        cube[28] = cube_tmp[37];
        cube[29] = cube_tmp[38];
        cube[30] = cube_tmp[39];
        cube[31] = cube_tmp[40];
        cube[32] = cube_tmp[41];
        cube[33] = cube_tmp[42];
        cube[34] = cube_tmp[43];
        cube[35] = cube_tmp[44];
        cube[36] = cube_tmp[45];
        cube[37] = cube_tmp[10];
        cube[38] = cube_tmp[11];
        cube[39] = cube_tmp[12];
        cube[40] = cube_tmp[13];
        cube[41] = cube_tmp[14];
        cube[42] = cube_tmp[15];
        cube[43] = cube_tmp[16];
        cube[44] = cube_tmp[17];
        cube[45] = cube_tmp[18];
        cube[46] = cube_tmp[48];
        cube[47] = cube_tmp[51];
        cube[48] = cube_tmp[54];
        cube[49] = cube_tmp[47];
        cube[51] = cube_tmp[53];
        cube[52] = cube_tmp[46];
        cube[53] = cube_tmp[49];
        cube[54] = cube_tmp[52];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[3];
        cube[2] = cube_tmp[6];
        cube[3] = cube_tmp[9];
        cube[4] = cube_tmp[2];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[4];
        cube[9] = cube_tmp[7];
        cube[10] = cube_tmp[37];
        cube[11] = cube_tmp[38];
        cube[12] = cube_tmp[39];
        cube[13] = cube_tmp[40];
        cube[14] = cube_tmp[41];
        cube[15] = cube_tmp[42];
        cube[16] = cube_tmp[43];
        cube[17] = cube_tmp[44];
        cube[18] = cube_tmp[45];
        cube[19] = cube_tmp[10];
        cube[20] = cube_tmp[11];
        cube[21] = cube_tmp[12];
        cube[22] = cube_tmp[13];
        cube[23] = cube_tmp[14];
        cube[24] = cube_tmp[15];
        cube[25] = cube_tmp[16];
        cube[26] = cube_tmp[17];
        cube[27] = cube_tmp[18];
        cube[28] = cube_tmp[19];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[21];
        cube[31] = cube_tmp[22];
        cube[32] = cube_tmp[23];
        cube[33] = cube_tmp[24];
        cube[34] = cube_tmp[25];
        cube[35] = cube_tmp[26];
        cube[36] = cube_tmp[27];
        cube[37] = cube_tmp[28];
        cube[38] = cube_tmp[29];
        cube[39] = cube_tmp[30];
        cube[40] = cube_tmp[31];
        cube[41] = cube_tmp[32];
        cube[42] = cube_tmp[33];
        cube[43] = cube_tmp[34];
        cube[44] = cube_tmp[35];
        cube[45] = cube_tmp[36];
        cube[46] = cube_tmp[52];
        cube[47] = cube_tmp[49];
        cube[48] = cube_tmp[46];
        cube[49] = cube_tmp[53];
        cube[51] = cube_tmp[47];
        cube[52] = cube_tmp[54];
        cube[53] = cube_tmp[51];
        cube[54] = cube_tmp[48];
        break;

    case Z:
        cube[1] = cube_tmp[16];
        cube[2] = cube_tmp[13];
        cube[3] = cube_tmp[10];
        cube[4] = cube_tmp[17];
        cube[5] = cube_tmp[14];
        cube[6] = cube_tmp[11];
        cube[7] = cube_tmp[18];
        cube[8] = cube_tmp[15];
        cube[9] = cube_tmp[12];
        cube[10] = cube_tmp[52];
        cube[11] = cube_tmp[49];
        cube[12] = cube_tmp[46];
        cube[13] = cube_tmp[53];
        cube[14] = cube_tmp[50];
        cube[15] = cube_tmp[47];
        cube[16] = cube_tmp[54];
        cube[17] = cube_tmp[51];
        cube[18] = cube_tmp[48];
        cube[19] = cube_tmp[25];
        cube[20] = cube_tmp[22];
        cube[21] = cube_tmp[19];
        cube[22] = cube_tmp[26];
        cube[24] = cube_tmp[20];
        cube[25] = cube_tmp[27];
        cube[26] = cube_tmp[24];
        cube[27] = cube_tmp[21];
        cube[28] = cube_tmp[7];
        cube[29] = cube_tmp[4];
        cube[30] = cube_tmp[1];
        cube[31] = cube_tmp[8];
        cube[32] = cube_tmp[5];
        cube[33] = cube_tmp[2];
        cube[34] = cube_tmp[9];
        cube[35] = cube_tmp[6];
        cube[36] = cube_tmp[3];
        cube[37] = cube_tmp[39];
        cube[38] = cube_tmp[42];
        cube[39] = cube_tmp[45];
        cube[40] = cube_tmp[38];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[37];
        cube[44] = cube_tmp[40];
        cube[45] = cube_tmp[43];
        cube[46] = cube_tmp[34];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[28];
        cube[49] = cube_tmp[35];
        cube[50] = cube_tmp[32];
        cube[51] = cube_tmp[29];
        cube[52] = cube_tmp[36];
        cube[53] = cube_tmp[33];
        cube[54] = cube_tmp[30];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[30];
        cube[2] = cube_tmp[33];
        cube[3] = cube_tmp[36];
        cube[4] = cube_tmp[29];
        cube[5] = cube_tmp[32];
        cube[6] = cube_tmp[35];
        cube[7] = cube_tmp[28];
        cube[8] = cube_tmp[31];
        cube[9] = cube_tmp[34];
        cube[10] = cube_tmp[3];
        cube[11] = cube_tmp[6];
        cube[12] = cube_tmp[9];
        cube[13] = cube_tmp[2];
        cube[14] = cube_tmp[5];
        cube[15] = cube_tmp[8];
        cube[16] = cube_tmp[1];
        cube[17] = cube_tmp[4];
        cube[18] = cube_tmp[7];
        cube[19] = cube_tmp[21];
        cube[20] = cube_tmp[24];
        cube[21] = cube_tmp[27];
        cube[22] = cube_tmp[20];
        cube[24] = cube_tmp[26];
        cube[25] = cube_tmp[19];
        cube[26] = cube_tmp[22];
        cube[27] = cube_tmp[25];
        cube[28] = cube_tmp[48];
        cube[29] = cube_tmp[51];
        cube[30] = cube_tmp[54];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[50];
        cube[33] = cube_tmp[53];
        cube[34] = cube_tmp[46];
        cube[35] = cube_tmp[49];
        cube[36] = cube_tmp[52];
        cube[37] = cube_tmp[43];
        cube[38] = cube_tmp[40];
        cube[39] = cube_tmp[37];
        cube[40] = cube_tmp[44];
        cube[42] = cube_tmp[38];
        cube[43] = cube_tmp[45];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[39];
        cube[46] = cube_tmp[12];
        cube[47] = cube_tmp[15];
        cube[48] = cube_tmp[18];
        cube[49] = cube_tmp[11];
        cube[50] = cube_tmp[14];
        cube[51] = cube_tmp[17];
        cube[52] = cube_tmp[10];
        cube[53] = cube_tmp[13];
        cube[54] = cube_tmp[16];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

void
rotate_444(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[13];
        cube[2] = cube_tmp[9];
        cube[3] = cube_tmp[5];
        cube[4] = cube_tmp[1];
        cube[5] = cube_tmp[14];
        cube[6] = cube_tmp[10];
        cube[7] = cube_tmp[6];
        cube[8] = cube_tmp[2];
        cube[9] = cube_tmp[15];
        cube[10] = cube_tmp[11];
        cube[11] = cube_tmp[7];
        cube[12] = cube_tmp[3];
        cube[13] = cube_tmp[16];
        cube[14] = cube_tmp[12];
        cube[15] = cube_tmp[8];
        cube[16] = cube_tmp[4];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[35];
        cube[20] = cube_tmp[36];
        cube[33] = cube_tmp[49];
        cube[34] = cube_tmp[50];
        cube[35] = cube_tmp[51];
        cube[36] = cube_tmp[52];
        cube[49] = cube_tmp[65];
        cube[50] = cube_tmp[66];
        cube[51] = cube_tmp[67];
        cube[52] = cube_tmp[68];
        cube[65] = cube_tmp[17];
        cube[66] = cube_tmp[18];
        cube[67] = cube_tmp[19];
        cube[68] = cube_tmp[20];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[4];
        cube[2] = cube_tmp[8];
        cube[3] = cube_tmp[12];
        cube[4] = cube_tmp[16];
        cube[5] = cube_tmp[3];
        cube[6] = cube_tmp[7];
        cube[7] = cube_tmp[11];
        cube[8] = cube_tmp[15];
        cube[9] = cube_tmp[2];
        cube[10] = cube_tmp[6];
        cube[11] = cube_tmp[10];
        cube[12] = cube_tmp[14];
        cube[13] = cube_tmp[1];
        cube[14] = cube_tmp[5];
        cube[15] = cube_tmp[9];
        cube[16] = cube_tmp[13];
        cube[17] = cube_tmp[65];
        cube[18] = cube_tmp[66];
        cube[19] = cube_tmp[67];
        cube[20] = cube_tmp[68];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[19];
        cube[36] = cube_tmp[20];
        cube[49] = cube_tmp[33];
        cube[50] = cube_tmp[34];
        cube[51] = cube_tmp[35];
        cube[52] = cube_tmp[36];
        cube[65] = cube_tmp[49];
        cube[66] = cube_tmp[50];
        cube[67] = cube_tmp[51];
        cube[68] = cube_tmp[52];
        break;

    case U2:
        cube[1] = cube_tmp[16];
        cube[2] = cube_tmp[15];
        cube[3] = cube_tmp[14];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[12];
        cube[6] = cube_tmp[11];
        cube[7] = cube_tmp[10];
        cube[8] = cube_tmp[9];
        cube[9] = cube_tmp[8];
        cube[10] = cube_tmp[7];
        cube[11] = cube_tmp[6];
        cube[12] = cube_tmp[5];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[3];
        cube[15] = cube_tmp[2];
        cube[16] = cube_tmp[1];
        cube[17] = cube_tmp[49];
        cube[18] = cube_tmp[50];
        cube[19] = cube_tmp[51];
        cube[20] = cube_tmp[52];
        cube[33] = cube_tmp[65];
        cube[34] = cube_tmp[66];
        cube[35] = cube_tmp[67];
        cube[36] = cube_tmp[68];
        cube[49] = cube_tmp[17];
        cube[50] = cube_tmp[18];
        cube[51] = cube_tmp[19];
        cube[52] = cube_tmp[20];
        cube[65] = cube_tmp[33];
        cube[66] = cube_tmp[34];
        cube[67] = cube_tmp[35];
        cube[68] = cube_tmp[36];
        break;

    case Uw:
        cube[1] = cube_tmp[13];
        cube[2] = cube_tmp[9];
        cube[3] = cube_tmp[5];
        cube[4] = cube_tmp[1];
        cube[5] = cube_tmp[14];
        cube[6] = cube_tmp[10];
        cube[7] = cube_tmp[6];
        cube[8] = cube_tmp[2];
        cube[9] = cube_tmp[15];
        cube[10] = cube_tmp[11];
        cube[11] = cube_tmp[7];
        cube[12] = cube_tmp[3];
        cube[13] = cube_tmp[16];
        cube[14] = cube_tmp[12];
        cube[15] = cube_tmp[8];
        cube[16] = cube_tmp[4];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[35];
        cube[20] = cube_tmp[36];
        cube[21] = cube_tmp[37];
        cube[22] = cube_tmp[38];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[40];
        cube[33] = cube_tmp[49];
        cube[34] = cube_tmp[50];
        cube[35] = cube_tmp[51];
        cube[36] = cube_tmp[52];
        cube[37] = cube_tmp[53];
        cube[38] = cube_tmp[54];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[56];
        cube[49] = cube_tmp[65];
        cube[50] = cube_tmp[66];
        cube[51] = cube_tmp[67];
        cube[52] = cube_tmp[68];
        cube[53] = cube_tmp[69];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[71];
        cube[56] = cube_tmp[72];
        cube[65] = cube_tmp[17];
        cube[66] = cube_tmp[18];
        cube[67] = cube_tmp[19];
        cube[68] = cube_tmp[20];
        cube[69] = cube_tmp[21];
        cube[70] = cube_tmp[22];
        cube[71] = cube_tmp[23];
        cube[72] = cube_tmp[24];
        break;

    case Uw_PRIME:
        cube[1] = cube_tmp[4];
        cube[2] = cube_tmp[8];
        cube[3] = cube_tmp[12];
        cube[4] = cube_tmp[16];
        cube[5] = cube_tmp[3];
        cube[6] = cube_tmp[7];
        cube[7] = cube_tmp[11];
        cube[8] = cube_tmp[15];
        cube[9] = cube_tmp[2];
        cube[10] = cube_tmp[6];
        cube[11] = cube_tmp[10];
        cube[12] = cube_tmp[14];
        cube[13] = cube_tmp[1];
        cube[14] = cube_tmp[5];
        cube[15] = cube_tmp[9];
        cube[16] = cube_tmp[13];
        cube[17] = cube_tmp[65];
        cube[18] = cube_tmp[66];
        cube[19] = cube_tmp[67];
        cube[20] = cube_tmp[68];
        cube[21] = cube_tmp[69];
        cube[22] = cube_tmp[70];
        cube[23] = cube_tmp[71];
        cube[24] = cube_tmp[72];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[19];
        cube[36] = cube_tmp[20];
        cube[37] = cube_tmp[21];
        cube[38] = cube_tmp[22];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[24];
        cube[49] = cube_tmp[33];
        cube[50] = cube_tmp[34];
        cube[51] = cube_tmp[35];
        cube[52] = cube_tmp[36];
        cube[53] = cube_tmp[37];
        cube[54] = cube_tmp[38];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[40];
        cube[65] = cube_tmp[49];
        cube[66] = cube_tmp[50];
        cube[67] = cube_tmp[51];
        cube[68] = cube_tmp[52];
        cube[69] = cube_tmp[53];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[55];
        cube[72] = cube_tmp[56];
        break;

    case Uw2:
        cube[1] = cube_tmp[16];
        cube[2] = cube_tmp[15];
        cube[3] = cube_tmp[14];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[12];
        cube[6] = cube_tmp[11];
        cube[7] = cube_tmp[10];
        cube[8] = cube_tmp[9];
        cube[9] = cube_tmp[8];
        cube[10] = cube_tmp[7];
        cube[11] = cube_tmp[6];
        cube[12] = cube_tmp[5];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[3];
        cube[15] = cube_tmp[2];
        cube[16] = cube_tmp[1];
        cube[17] = cube_tmp[49];
        cube[18] = cube_tmp[50];
        cube[19] = cube_tmp[51];
        cube[20] = cube_tmp[52];
        cube[21] = cube_tmp[53];
        cube[22] = cube_tmp[54];
        cube[23] = cube_tmp[55];
        cube[24] = cube_tmp[56];
        cube[33] = cube_tmp[65];
        cube[34] = cube_tmp[66];
        cube[35] = cube_tmp[67];
        cube[36] = cube_tmp[68];
        cube[37] = cube_tmp[69];
        cube[38] = cube_tmp[70];
        cube[39] = cube_tmp[71];
        cube[40] = cube_tmp[72];
        cube[49] = cube_tmp[17];
        cube[50] = cube_tmp[18];
        cube[51] = cube_tmp[19];
        cube[52] = cube_tmp[20];
        cube[53] = cube_tmp[21];
        cube[54] = cube_tmp[22];
        cube[55] = cube_tmp[23];
        cube[56] = cube_tmp[24];
        cube[65] = cube_tmp[33];
        cube[66] = cube_tmp[34];
        cube[67] = cube_tmp[35];
        cube[68] = cube_tmp[36];
        cube[69] = cube_tmp[37];
        cube[70] = cube_tmp[38];
        cube[71] = cube_tmp[39];
        cube[72] = cube_tmp[40];
        break;

    case L:
        cube[1] = cube_tmp[80];
        cube[5] = cube_tmp[76];
        cube[9] = cube_tmp[72];
        cube[13] = cube_tmp[68];
        cube[17] = cube_tmp[29];
        cube[18] = cube_tmp[25];
        cube[19] = cube_tmp[21];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[30];
        cube[22] = cube_tmp[26];
        cube[23] = cube_tmp[22];
        cube[24] = cube_tmp[18];
        cube[25] = cube_tmp[31];
        cube[26] = cube_tmp[27];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[19];
        cube[29] = cube_tmp[32];
        cube[30] = cube_tmp[28];
        cube[31] = cube_tmp[24];
        cube[32] = cube_tmp[20];
        cube[33] = cube_tmp[1];
        cube[37] = cube_tmp[5];
        cube[41] = cube_tmp[9];
        cube[45] = cube_tmp[13];
        cube[68] = cube_tmp[93];
        cube[72] = cube_tmp[89];
        cube[76] = cube_tmp[85];
        cube[80] = cube_tmp[81];
        cube[81] = cube_tmp[33];
        cube[85] = cube_tmp[37];
        cube[89] = cube_tmp[41];
        cube[93] = cube_tmp[45];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[33];
        cube[5] = cube_tmp[37];
        cube[9] = cube_tmp[41];
        cube[13] = cube_tmp[45];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[28];
        cube[20] = cube_tmp[32];
        cube[21] = cube_tmp[19];
        cube[22] = cube_tmp[23];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[31];
        cube[25] = cube_tmp[18];
        cube[26] = cube_tmp[22];
        cube[27] = cube_tmp[26];
        cube[28] = cube_tmp[30];
        cube[29] = cube_tmp[17];
        cube[30] = cube_tmp[21];
        cube[31] = cube_tmp[25];
        cube[32] = cube_tmp[29];
        cube[33] = cube_tmp[81];
        cube[37] = cube_tmp[85];
        cube[41] = cube_tmp[89];
        cube[45] = cube_tmp[93];
        cube[68] = cube_tmp[13];
        cube[72] = cube_tmp[9];
        cube[76] = cube_tmp[5];
        cube[80] = cube_tmp[1];
        cube[81] = cube_tmp[80];
        cube[85] = cube_tmp[76];
        cube[89] = cube_tmp[72];
        cube[93] = cube_tmp[68];
        break;

    case L2:
        cube[1] = cube_tmp[81];
        cube[5] = cube_tmp[85];
        cube[9] = cube_tmp[89];
        cube[13] = cube_tmp[93];
        cube[17] = cube_tmp[32];
        cube[18] = cube_tmp[31];
        cube[19] = cube_tmp[30];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[28];
        cube[22] = cube_tmp[27];
        cube[23] = cube_tmp[26];
        cube[24] = cube_tmp[25];
        cube[25] = cube_tmp[24];
        cube[26] = cube_tmp[23];
        cube[27] = cube_tmp[22];
        cube[28] = cube_tmp[21];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[19];
        cube[31] = cube_tmp[18];
        cube[32] = cube_tmp[17];
        cube[33] = cube_tmp[80];
        cube[37] = cube_tmp[76];
        cube[41] = cube_tmp[72];
        cube[45] = cube_tmp[68];
        cube[68] = cube_tmp[45];
        cube[72] = cube_tmp[41];
        cube[76] = cube_tmp[37];
        cube[80] = cube_tmp[33];
        cube[81] = cube_tmp[1];
        cube[85] = cube_tmp[5];
        cube[89] = cube_tmp[9];
        cube[93] = cube_tmp[13];
        break;

    case Lw:
        cube[1] = cube_tmp[80];
        cube[2] = cube_tmp[79];
        cube[5] = cube_tmp[76];
        cube[6] = cube_tmp[75];
        cube[9] = cube_tmp[72];
        cube[10] = cube_tmp[71];
        cube[13] = cube_tmp[68];
        cube[14] = cube_tmp[67];
        cube[17] = cube_tmp[29];
        cube[18] = cube_tmp[25];
        cube[19] = cube_tmp[21];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[30];
        cube[22] = cube_tmp[26];
        cube[23] = cube_tmp[22];
        cube[24] = cube_tmp[18];
        cube[25] = cube_tmp[31];
        cube[26] = cube_tmp[27];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[19];
        cube[29] = cube_tmp[32];
        cube[30] = cube_tmp[28];
        cube[31] = cube_tmp[24];
        cube[32] = cube_tmp[20];
        cube[33] = cube_tmp[1];
        cube[34] = cube_tmp[2];
        cube[37] = cube_tmp[5];
        cube[38] = cube_tmp[6];
        cube[41] = cube_tmp[9];
        cube[42] = cube_tmp[10];
        cube[45] = cube_tmp[13];
        cube[46] = cube_tmp[14];
        cube[67] = cube_tmp[94];
        cube[68] = cube_tmp[93];
        cube[71] = cube_tmp[90];
        cube[72] = cube_tmp[89];
        cube[75] = cube_tmp[86];
        cube[76] = cube_tmp[85];
        cube[79] = cube_tmp[82];
        cube[80] = cube_tmp[81];
        cube[81] = cube_tmp[33];
        cube[82] = cube_tmp[34];
        cube[85] = cube_tmp[37];
        cube[86] = cube_tmp[38];
        cube[89] = cube_tmp[41];
        cube[90] = cube_tmp[42];
        cube[93] = cube_tmp[45];
        cube[94] = cube_tmp[46];
        break;

    case Lw_PRIME:
        cube[1] = cube_tmp[33];
        cube[2] = cube_tmp[34];
        cube[5] = cube_tmp[37];
        cube[6] = cube_tmp[38];
        cube[9] = cube_tmp[41];
        cube[10] = cube_tmp[42];
        cube[13] = cube_tmp[45];
        cube[14] = cube_tmp[46];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[28];
        cube[20] = cube_tmp[32];
        cube[21] = cube_tmp[19];
        cube[22] = cube_tmp[23];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[31];
        cube[25] = cube_tmp[18];
        cube[26] = cube_tmp[22];
        cube[27] = cube_tmp[26];
        cube[28] = cube_tmp[30];
        cube[29] = cube_tmp[17];
        cube[30] = cube_tmp[21];
        cube[31] = cube_tmp[25];
        cube[32] = cube_tmp[29];
        cube[33] = cube_tmp[81];
        cube[34] = cube_tmp[82];
        cube[37] = cube_tmp[85];
        cube[38] = cube_tmp[86];
        cube[41] = cube_tmp[89];
        cube[42] = cube_tmp[90];
        cube[45] = cube_tmp[93];
        cube[46] = cube_tmp[94];
        cube[67] = cube_tmp[14];
        cube[68] = cube_tmp[13];
        cube[71] = cube_tmp[10];
        cube[72] = cube_tmp[9];
        cube[75] = cube_tmp[6];
        cube[76] = cube_tmp[5];
        cube[79] = cube_tmp[2];
        cube[80] = cube_tmp[1];
        cube[81] = cube_tmp[80];
        cube[82] = cube_tmp[79];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[75];
        cube[89] = cube_tmp[72];
        cube[90] = cube_tmp[71];
        cube[93] = cube_tmp[68];
        cube[94] = cube_tmp[67];
        break;

    case Lw2:
        cube[1] = cube_tmp[81];
        cube[2] = cube_tmp[82];
        cube[5] = cube_tmp[85];
        cube[6] = cube_tmp[86];
        cube[9] = cube_tmp[89];
        cube[10] = cube_tmp[90];
        cube[13] = cube_tmp[93];
        cube[14] = cube_tmp[94];
        cube[17] = cube_tmp[32];
        cube[18] = cube_tmp[31];
        cube[19] = cube_tmp[30];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[28];
        cube[22] = cube_tmp[27];
        cube[23] = cube_tmp[26];
        cube[24] = cube_tmp[25];
        cube[25] = cube_tmp[24];
        cube[26] = cube_tmp[23];
        cube[27] = cube_tmp[22];
        cube[28] = cube_tmp[21];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[19];
        cube[31] = cube_tmp[18];
        cube[32] = cube_tmp[17];
        cube[33] = cube_tmp[80];
        cube[34] = cube_tmp[79];
        cube[37] = cube_tmp[76];
        cube[38] = cube_tmp[75];
        cube[41] = cube_tmp[72];
        cube[42] = cube_tmp[71];
        cube[45] = cube_tmp[68];
        cube[46] = cube_tmp[67];
        cube[67] = cube_tmp[46];
        cube[68] = cube_tmp[45];
        cube[71] = cube_tmp[42];
        cube[72] = cube_tmp[41];
        cube[75] = cube_tmp[38];
        cube[76] = cube_tmp[37];
        cube[79] = cube_tmp[34];
        cube[80] = cube_tmp[33];
        cube[81] = cube_tmp[1];
        cube[82] = cube_tmp[2];
        cube[85] = cube_tmp[5];
        cube[86] = cube_tmp[6];
        cube[89] = cube_tmp[9];
        cube[90] = cube_tmp[10];
        cube[93] = cube_tmp[13];
        cube[94] = cube_tmp[14];
        break;

    case F:
        cube[13] = cube_tmp[32];
        cube[14] = cube_tmp[28];
        cube[15] = cube_tmp[24];
        cube[16] = cube_tmp[20];
        cube[20] = cube_tmp[81];
        cube[24] = cube_tmp[82];
        cube[28] = cube_tmp[83];
        cube[32] = cube_tmp[84];
        cube[33] = cube_tmp[45];
        cube[34] = cube_tmp[41];
        cube[35] = cube_tmp[37];
        cube[36] = cube_tmp[33];
        cube[37] = cube_tmp[46];
        cube[38] = cube_tmp[42];
        cube[39] = cube_tmp[38];
        cube[40] = cube_tmp[34];
        cube[41] = cube_tmp[47];
        cube[42] = cube_tmp[43];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[35];
        cube[45] = cube_tmp[48];
        cube[46] = cube_tmp[44];
        cube[47] = cube_tmp[40];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[13];
        cube[53] = cube_tmp[14];
        cube[57] = cube_tmp[15];
        cube[61] = cube_tmp[16];
        cube[81] = cube_tmp[61];
        cube[82] = cube_tmp[57];
        cube[83] = cube_tmp[53];
        cube[84] = cube_tmp[49];
        break;

    case F_PRIME:
        cube[13] = cube_tmp[49];
        cube[14] = cube_tmp[53];
        cube[15] = cube_tmp[57];
        cube[16] = cube_tmp[61];
        cube[20] = cube_tmp[16];
        cube[24] = cube_tmp[15];
        cube[28] = cube_tmp[14];
        cube[32] = cube_tmp[13];
        cube[33] = cube_tmp[36];
        cube[34] = cube_tmp[40];
        cube[35] = cube_tmp[44];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[35];
        cube[38] = cube_tmp[39];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[47];
        cube[41] = cube_tmp[34];
        cube[42] = cube_tmp[38];
        cube[43] = cube_tmp[42];
        cube[44] = cube_tmp[46];
        cube[45] = cube_tmp[33];
        cube[46] = cube_tmp[37];
        cube[47] = cube_tmp[41];
        cube[48] = cube_tmp[45];
        cube[49] = cube_tmp[84];
        cube[53] = cube_tmp[83];
        cube[57] = cube_tmp[82];
        cube[61] = cube_tmp[81];
        cube[81] = cube_tmp[20];
        cube[82] = cube_tmp[24];
        cube[83] = cube_tmp[28];
        cube[84] = cube_tmp[32];
        break;

    case F2:
        cube[13] = cube_tmp[84];
        cube[14] = cube_tmp[83];
        cube[15] = cube_tmp[82];
        cube[16] = cube_tmp[81];
        cube[20] = cube_tmp[61];
        cube[24] = cube_tmp[57];
        cube[28] = cube_tmp[53];
        cube[32] = cube_tmp[49];
        cube[33] = cube_tmp[48];
        cube[34] = cube_tmp[47];
        cube[35] = cube_tmp[46];
        cube[36] = cube_tmp[45];
        cube[37] = cube_tmp[44];
        cube[38] = cube_tmp[43];
        cube[39] = cube_tmp[42];
        cube[40] = cube_tmp[41];
        cube[41] = cube_tmp[40];
        cube[42] = cube_tmp[39];
        cube[43] = cube_tmp[38];
        cube[44] = cube_tmp[37];
        cube[45] = cube_tmp[36];
        cube[46] = cube_tmp[35];
        cube[47] = cube_tmp[34];
        cube[48] = cube_tmp[33];
        cube[49] = cube_tmp[32];
        cube[53] = cube_tmp[28];
        cube[57] = cube_tmp[24];
        cube[61] = cube_tmp[20];
        cube[81] = cube_tmp[16];
        cube[82] = cube_tmp[15];
        cube[83] = cube_tmp[14];
        cube[84] = cube_tmp[13];
        break;

    case Fw:
        cube[9] = cube_tmp[31];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[19];
        cube[13] = cube_tmp[32];
        cube[14] = cube_tmp[28];
        cube[15] = cube_tmp[24];
        cube[16] = cube_tmp[20];
        cube[19] = cube_tmp[85];
        cube[20] = cube_tmp[81];
        cube[23] = cube_tmp[86];
        cube[24] = cube_tmp[82];
        cube[27] = cube_tmp[87];
        cube[28] = cube_tmp[83];
        cube[31] = cube_tmp[88];
        cube[32] = cube_tmp[84];
        cube[33] = cube_tmp[45];
        cube[34] = cube_tmp[41];
        cube[35] = cube_tmp[37];
        cube[36] = cube_tmp[33];
        cube[37] = cube_tmp[46];
        cube[38] = cube_tmp[42];
        cube[39] = cube_tmp[38];
        cube[40] = cube_tmp[34];
        cube[41] = cube_tmp[47];
        cube[42] = cube_tmp[43];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[35];
        cube[45] = cube_tmp[48];
        cube[46] = cube_tmp[44];
        cube[47] = cube_tmp[40];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[13];
        cube[50] = cube_tmp[9];
        cube[53] = cube_tmp[14];
        cube[54] = cube_tmp[10];
        cube[57] = cube_tmp[15];
        cube[58] = cube_tmp[11];
        cube[61] = cube_tmp[16];
        cube[62] = cube_tmp[12];
        cube[81] = cube_tmp[61];
        cube[82] = cube_tmp[57];
        cube[83] = cube_tmp[53];
        cube[84] = cube_tmp[49];
        cube[85] = cube_tmp[62];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[54];
        cube[88] = cube_tmp[50];
        break;

    case Fw_PRIME:
        cube[9] = cube_tmp[50];
        cube[10] = cube_tmp[54];
        cube[11] = cube_tmp[58];
        cube[12] = cube_tmp[62];
        cube[13] = cube_tmp[49];
        cube[14] = cube_tmp[53];
        cube[15] = cube_tmp[57];
        cube[16] = cube_tmp[61];
        cube[19] = cube_tmp[12];
        cube[20] = cube_tmp[16];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[15];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[14];
        cube[31] = cube_tmp[9];
        cube[32] = cube_tmp[13];
        cube[33] = cube_tmp[36];
        cube[34] = cube_tmp[40];
        cube[35] = cube_tmp[44];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[35];
        cube[38] = cube_tmp[39];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[47];
        cube[41] = cube_tmp[34];
        cube[42] = cube_tmp[38];
        cube[43] = cube_tmp[42];
        cube[44] = cube_tmp[46];
        cube[45] = cube_tmp[33];
        cube[46] = cube_tmp[37];
        cube[47] = cube_tmp[41];
        cube[48] = cube_tmp[45];
        cube[49] = cube_tmp[84];
        cube[50] = cube_tmp[88];
        cube[53] = cube_tmp[83];
        cube[54] = cube_tmp[87];
        cube[57] = cube_tmp[82];
        cube[58] = cube_tmp[86];
        cube[61] = cube_tmp[81];
        cube[62] = cube_tmp[85];
        cube[81] = cube_tmp[20];
        cube[82] = cube_tmp[24];
        cube[83] = cube_tmp[28];
        cube[84] = cube_tmp[32];
        cube[85] = cube_tmp[19];
        cube[86] = cube_tmp[23];
        cube[87] = cube_tmp[27];
        cube[88] = cube_tmp[31];
        break;

    case Fw2:
        cube[9] = cube_tmp[88];
        cube[10] = cube_tmp[87];
        cube[11] = cube_tmp[86];
        cube[12] = cube_tmp[85];
        cube[13] = cube_tmp[84];
        cube[14] = cube_tmp[83];
        cube[15] = cube_tmp[82];
        cube[16] = cube_tmp[81];
        cube[19] = cube_tmp[62];
        cube[20] = cube_tmp[61];
        cube[23] = cube_tmp[58];
        cube[24] = cube_tmp[57];
        cube[27] = cube_tmp[54];
        cube[28] = cube_tmp[53];
        cube[31] = cube_tmp[50];
        cube[32] = cube_tmp[49];
        cube[33] = cube_tmp[48];
        cube[34] = cube_tmp[47];
        cube[35] = cube_tmp[46];
        cube[36] = cube_tmp[45];
        cube[37] = cube_tmp[44];
        cube[38] = cube_tmp[43];
        cube[39] = cube_tmp[42];
        cube[40] = cube_tmp[41];
        cube[41] = cube_tmp[40];
        cube[42] = cube_tmp[39];
        cube[43] = cube_tmp[38];
        cube[44] = cube_tmp[37];
        cube[45] = cube_tmp[36];
        cube[46] = cube_tmp[35];
        cube[47] = cube_tmp[34];
        cube[48] = cube_tmp[33];
        cube[49] = cube_tmp[32];
        cube[50] = cube_tmp[31];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[27];
        cube[57] = cube_tmp[24];
        cube[58] = cube_tmp[23];
        cube[61] = cube_tmp[20];
        cube[62] = cube_tmp[19];
        cube[81] = cube_tmp[16];
        cube[82] = cube_tmp[15];
        cube[83] = cube_tmp[14];
        cube[84] = cube_tmp[13];
        cube[85] = cube_tmp[12];
        cube[86] = cube_tmp[11];
        cube[87] = cube_tmp[10];
        cube[88] = cube_tmp[9];
        break;

    case R:
        cube[4] = cube_tmp[36];
        cube[8] = cube_tmp[40];
        cube[12] = cube_tmp[44];
        cube[16] = cube_tmp[48];
        cube[36] = cube_tmp[84];
        cube[40] = cube_tmp[88];
        cube[44] = cube_tmp[92];
        cube[48] = cube_tmp[96];
        cube[49] = cube_tmp[61];
        cube[50] = cube_tmp[57];
        cube[51] = cube_tmp[53];
        cube[52] = cube_tmp[49];
        cube[53] = cube_tmp[62];
        cube[54] = cube_tmp[58];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[63];
        cube[58] = cube_tmp[59];
        cube[59] = cube_tmp[55];
        cube[60] = cube_tmp[51];
        cube[61] = cube_tmp[64];
        cube[62] = cube_tmp[60];
        cube[63] = cube_tmp[56];
        cube[64] = cube_tmp[52];
        cube[65] = cube_tmp[16];
        cube[69] = cube_tmp[12];
        cube[73] = cube_tmp[8];
        cube[77] = cube_tmp[4];
        cube[84] = cube_tmp[77];
        cube[88] = cube_tmp[73];
        cube[92] = cube_tmp[69];
        cube[96] = cube_tmp[65];
        break;

    case R_PRIME:
        cube[4] = cube_tmp[77];
        cube[8] = cube_tmp[73];
        cube[12] = cube_tmp[69];
        cube[16] = cube_tmp[65];
        cube[36] = cube_tmp[4];
        cube[40] = cube_tmp[8];
        cube[44] = cube_tmp[12];
        cube[48] = cube_tmp[16];
        cube[49] = cube_tmp[52];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[60];
        cube[52] = cube_tmp[64];
        cube[53] = cube_tmp[51];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[59];
        cube[56] = cube_tmp[63];
        cube[57] = cube_tmp[50];
        cube[58] = cube_tmp[54];
        cube[59] = cube_tmp[58];
        cube[60] = cube_tmp[62];
        cube[61] = cube_tmp[49];
        cube[62] = cube_tmp[53];
        cube[63] = cube_tmp[57];
        cube[64] = cube_tmp[61];
        cube[65] = cube_tmp[96];
        cube[69] = cube_tmp[92];
        cube[73] = cube_tmp[88];
        cube[77] = cube_tmp[84];
        cube[84] = cube_tmp[36];
        cube[88] = cube_tmp[40];
        cube[92] = cube_tmp[44];
        cube[96] = cube_tmp[48];
        break;

    case R2:
        cube[4] = cube_tmp[84];
        cube[8] = cube_tmp[88];
        cube[12] = cube_tmp[92];
        cube[16] = cube_tmp[96];
        cube[36] = cube_tmp[77];
        cube[40] = cube_tmp[73];
        cube[44] = cube_tmp[69];
        cube[48] = cube_tmp[65];
        cube[49] = cube_tmp[64];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[62];
        cube[52] = cube_tmp[61];
        cube[53] = cube_tmp[60];
        cube[54] = cube_tmp[59];
        cube[55] = cube_tmp[58];
        cube[56] = cube_tmp[57];
        cube[57] = cube_tmp[56];
        cube[58] = cube_tmp[55];
        cube[59] = cube_tmp[54];
        cube[60] = cube_tmp[53];
        cube[61] = cube_tmp[52];
        cube[62] = cube_tmp[51];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[49];
        cube[65] = cube_tmp[48];
        cube[69] = cube_tmp[44];
        cube[73] = cube_tmp[40];
        cube[77] = cube_tmp[36];
        cube[84] = cube_tmp[4];
        cube[88] = cube_tmp[8];
        cube[92] = cube_tmp[12];
        cube[96] = cube_tmp[16];
        break;

    case Rw:
        cube[3] = cube_tmp[35];
        cube[4] = cube_tmp[36];
        cube[7] = cube_tmp[39];
        cube[8] = cube_tmp[40];
        cube[11] = cube_tmp[43];
        cube[12] = cube_tmp[44];
        cube[15] = cube_tmp[47];
        cube[16] = cube_tmp[48];
        cube[35] = cube_tmp[83];
        cube[36] = cube_tmp[84];
        cube[39] = cube_tmp[87];
        cube[40] = cube_tmp[88];
        cube[43] = cube_tmp[91];
        cube[44] = cube_tmp[92];
        cube[47] = cube_tmp[95];
        cube[48] = cube_tmp[96];
        cube[49] = cube_tmp[61];
        cube[50] = cube_tmp[57];
        cube[51] = cube_tmp[53];
        cube[52] = cube_tmp[49];
        cube[53] = cube_tmp[62];
        cube[54] = cube_tmp[58];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[63];
        cube[58] = cube_tmp[59];
        cube[59] = cube_tmp[55];
        cube[60] = cube_tmp[51];
        cube[61] = cube_tmp[64];
        cube[62] = cube_tmp[60];
        cube[63] = cube_tmp[56];
        cube[64] = cube_tmp[52];
        cube[65] = cube_tmp[16];
        cube[66] = cube_tmp[15];
        cube[69] = cube_tmp[12];
        cube[70] = cube_tmp[11];
        cube[73] = cube_tmp[8];
        cube[74] = cube_tmp[7];
        cube[77] = cube_tmp[4];
        cube[78] = cube_tmp[3];
        cube[83] = cube_tmp[78];
        cube[84] = cube_tmp[77];
        cube[87] = cube_tmp[74];
        cube[88] = cube_tmp[73];
        cube[91] = cube_tmp[70];
        cube[92] = cube_tmp[69];
        cube[95] = cube_tmp[66];
        cube[96] = cube_tmp[65];
        break;

    case Rw_PRIME:
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[77];
        cube[7] = cube_tmp[74];
        cube[8] = cube_tmp[73];
        cube[11] = cube_tmp[70];
        cube[12] = cube_tmp[69];
        cube[15] = cube_tmp[66];
        cube[16] = cube_tmp[65];
        cube[35] = cube_tmp[3];
        cube[36] = cube_tmp[4];
        cube[39] = cube_tmp[7];
        cube[40] = cube_tmp[8];
        cube[43] = cube_tmp[11];
        cube[44] = cube_tmp[12];
        cube[47] = cube_tmp[15];
        cube[48] = cube_tmp[16];
        cube[49] = cube_tmp[52];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[60];
        cube[52] = cube_tmp[64];
        cube[53] = cube_tmp[51];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[59];
        cube[56] = cube_tmp[63];
        cube[57] = cube_tmp[50];
        cube[58] = cube_tmp[54];
        cube[59] = cube_tmp[58];
        cube[60] = cube_tmp[62];
        cube[61] = cube_tmp[49];
        cube[62] = cube_tmp[53];
        cube[63] = cube_tmp[57];
        cube[64] = cube_tmp[61];
        cube[65] = cube_tmp[96];
        cube[66] = cube_tmp[95];
        cube[69] = cube_tmp[92];
        cube[70] = cube_tmp[91];
        cube[73] = cube_tmp[88];
        cube[74] = cube_tmp[87];
        cube[77] = cube_tmp[84];
        cube[78] = cube_tmp[83];
        cube[83] = cube_tmp[35];
        cube[84] = cube_tmp[36];
        cube[87] = cube_tmp[39];
        cube[88] = cube_tmp[40];
        cube[91] = cube_tmp[43];
        cube[92] = cube_tmp[44];
        cube[95] = cube_tmp[47];
        cube[96] = cube_tmp[48];
        break;

    case Rw2:
        cube[3] = cube_tmp[83];
        cube[4] = cube_tmp[84];
        cube[7] = cube_tmp[87];
        cube[8] = cube_tmp[88];
        cube[11] = cube_tmp[91];
        cube[12] = cube_tmp[92];
        cube[15] = cube_tmp[95];
        cube[16] = cube_tmp[96];
        cube[35] = cube_tmp[78];
        cube[36] = cube_tmp[77];
        cube[39] = cube_tmp[74];
        cube[40] = cube_tmp[73];
        cube[43] = cube_tmp[70];
        cube[44] = cube_tmp[69];
        cube[47] = cube_tmp[66];
        cube[48] = cube_tmp[65];
        cube[49] = cube_tmp[64];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[62];
        cube[52] = cube_tmp[61];
        cube[53] = cube_tmp[60];
        cube[54] = cube_tmp[59];
        cube[55] = cube_tmp[58];
        cube[56] = cube_tmp[57];
        cube[57] = cube_tmp[56];
        cube[58] = cube_tmp[55];
        cube[59] = cube_tmp[54];
        cube[60] = cube_tmp[53];
        cube[61] = cube_tmp[52];
        cube[62] = cube_tmp[51];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[49];
        cube[65] = cube_tmp[48];
        cube[66] = cube_tmp[47];
        cube[69] = cube_tmp[44];
        cube[70] = cube_tmp[43];
        cube[73] = cube_tmp[40];
        cube[74] = cube_tmp[39];
        cube[77] = cube_tmp[36];
        cube[78] = cube_tmp[35];
        cube[83] = cube_tmp[3];
        cube[84] = cube_tmp[4];
        cube[87] = cube_tmp[7];
        cube[88] = cube_tmp[8];
        cube[91] = cube_tmp[11];
        cube[92] = cube_tmp[12];
        cube[95] = cube_tmp[15];
        cube[96] = cube_tmp[16];
        break;

    case B:
        cube[1] = cube_tmp[52];
        cube[2] = cube_tmp[56];
        cube[3] = cube_tmp[60];
        cube[4] = cube_tmp[64];
        cube[17] = cube_tmp[4];
        cube[21] = cube_tmp[3];
        cube[25] = cube_tmp[2];
        cube[29] = cube_tmp[1];
        cube[52] = cube_tmp[96];
        cube[56] = cube_tmp[95];
        cube[60] = cube_tmp[94];
        cube[64] = cube_tmp[93];
        cube[65] = cube_tmp[77];
        cube[66] = cube_tmp[73];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[65];
        cube[69] = cube_tmp[78];
        cube[70] = cube_tmp[74];
        cube[71] = cube_tmp[70];
        cube[72] = cube_tmp[66];
        cube[73] = cube_tmp[79];
        cube[74] = cube_tmp[75];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[67];
        cube[77] = cube_tmp[80];
        cube[78] = cube_tmp[76];
        cube[79] = cube_tmp[72];
        cube[80] = cube_tmp[68];
        cube[93] = cube_tmp[17];
        cube[94] = cube_tmp[21];
        cube[95] = cube_tmp[25];
        cube[96] = cube_tmp[29];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[29];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[17];
        cube[17] = cube_tmp[93];
        cube[21] = cube_tmp[94];
        cube[25] = cube_tmp[95];
        cube[29] = cube_tmp[96];
        cube[52] = cube_tmp[1];
        cube[56] = cube_tmp[2];
        cube[60] = cube_tmp[3];
        cube[64] = cube_tmp[4];
        cube[65] = cube_tmp[68];
        cube[66] = cube_tmp[72];
        cube[67] = cube_tmp[76];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[71];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[79];
        cube[73] = cube_tmp[66];
        cube[74] = cube_tmp[70];
        cube[75] = cube_tmp[74];
        cube[76] = cube_tmp[78];
        cube[77] = cube_tmp[65];
        cube[78] = cube_tmp[69];
        cube[79] = cube_tmp[73];
        cube[80] = cube_tmp[77];
        cube[93] = cube_tmp[64];
        cube[94] = cube_tmp[60];
        cube[95] = cube_tmp[56];
        cube[96] = cube_tmp[52];
        break;

    case B2:
        cube[1] = cube_tmp[96];
        cube[2] = cube_tmp[95];
        cube[3] = cube_tmp[94];
        cube[4] = cube_tmp[93];
        cube[17] = cube_tmp[64];
        cube[21] = cube_tmp[60];
        cube[25] = cube_tmp[56];
        cube[29] = cube_tmp[52];
        cube[52] = cube_tmp[29];
        cube[56] = cube_tmp[25];
        cube[60] = cube_tmp[21];
        cube[64] = cube_tmp[17];
        cube[65] = cube_tmp[80];
        cube[66] = cube_tmp[79];
        cube[67] = cube_tmp[78];
        cube[68] = cube_tmp[77];
        cube[69] = cube_tmp[76];
        cube[70] = cube_tmp[75];
        cube[71] = cube_tmp[74];
        cube[72] = cube_tmp[73];
        cube[73] = cube_tmp[72];
        cube[74] = cube_tmp[71];
        cube[75] = cube_tmp[70];
        cube[76] = cube_tmp[69];
        cube[77] = cube_tmp[68];
        cube[78] = cube_tmp[67];
        cube[79] = cube_tmp[66];
        cube[80] = cube_tmp[65];
        cube[93] = cube_tmp[4];
        cube[94] = cube_tmp[3];
        cube[95] = cube_tmp[2];
        cube[96] = cube_tmp[1];
        break;

    case Bw:
        cube[1] = cube_tmp[52];
        cube[2] = cube_tmp[56];
        cube[3] = cube_tmp[60];
        cube[4] = cube_tmp[64];
        cube[5] = cube_tmp[51];
        cube[6] = cube_tmp[55];
        cube[7] = cube_tmp[59];
        cube[8] = cube_tmp[63];
        cube[17] = cube_tmp[4];
        cube[18] = cube_tmp[8];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[7];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[6];
        cube[29] = cube_tmp[1];
        cube[30] = cube_tmp[5];
        cube[51] = cube_tmp[92];
        cube[52] = cube_tmp[96];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[95];
        cube[59] = cube_tmp[90];
        cube[60] = cube_tmp[94];
        cube[63] = cube_tmp[89];
        cube[64] = cube_tmp[93];
        cube[65] = cube_tmp[77];
        cube[66] = cube_tmp[73];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[65];
        cube[69] = cube_tmp[78];
        cube[70] = cube_tmp[74];
        cube[71] = cube_tmp[70];
        cube[72] = cube_tmp[66];
        cube[73] = cube_tmp[79];
        cube[74] = cube_tmp[75];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[67];
        cube[77] = cube_tmp[80];
        cube[78] = cube_tmp[76];
        cube[79] = cube_tmp[72];
        cube[80] = cube_tmp[68];
        cube[89] = cube_tmp[18];
        cube[90] = cube_tmp[22];
        cube[91] = cube_tmp[26];
        cube[92] = cube_tmp[30];
        cube[93] = cube_tmp[17];
        cube[94] = cube_tmp[21];
        cube[95] = cube_tmp[25];
        cube[96] = cube_tmp[29];
        break;

    case Bw_PRIME:
        cube[1] = cube_tmp[29];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[17];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[26];
        cube[7] = cube_tmp[22];
        cube[8] = cube_tmp[18];
        cube[17] = cube_tmp[93];
        cube[18] = cube_tmp[89];
        cube[21] = cube_tmp[94];
        cube[22] = cube_tmp[90];
        cube[25] = cube_tmp[95];
        cube[26] = cube_tmp[91];
        cube[29] = cube_tmp[96];
        cube[30] = cube_tmp[92];
        cube[51] = cube_tmp[5];
        cube[52] = cube_tmp[1];
        cube[55] = cube_tmp[6];
        cube[56] = cube_tmp[2];
        cube[59] = cube_tmp[7];
        cube[60] = cube_tmp[3];
        cube[63] = cube_tmp[8];
        cube[64] = cube_tmp[4];
        cube[65] = cube_tmp[68];
        cube[66] = cube_tmp[72];
        cube[67] = cube_tmp[76];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[71];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[79];
        cube[73] = cube_tmp[66];
        cube[74] = cube_tmp[70];
        cube[75] = cube_tmp[74];
        cube[76] = cube_tmp[78];
        cube[77] = cube_tmp[65];
        cube[78] = cube_tmp[69];
        cube[79] = cube_tmp[73];
        cube[80] = cube_tmp[77];
        cube[89] = cube_tmp[63];
        cube[90] = cube_tmp[59];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[51];
        cube[93] = cube_tmp[64];
        cube[94] = cube_tmp[60];
        cube[95] = cube_tmp[56];
        cube[96] = cube_tmp[52];
        break;

    case Bw2:
        cube[1] = cube_tmp[96];
        cube[2] = cube_tmp[95];
        cube[3] = cube_tmp[94];
        cube[4] = cube_tmp[93];
        cube[5] = cube_tmp[92];
        cube[6] = cube_tmp[91];
        cube[7] = cube_tmp[90];
        cube[8] = cube_tmp[89];
        cube[17] = cube_tmp[64];
        cube[18] = cube_tmp[63];
        cube[21] = cube_tmp[60];
        cube[22] = cube_tmp[59];
        cube[25] = cube_tmp[56];
        cube[26] = cube_tmp[55];
        cube[29] = cube_tmp[52];
        cube[30] = cube_tmp[51];
        cube[51] = cube_tmp[30];
        cube[52] = cube_tmp[29];
        cube[55] = cube_tmp[26];
        cube[56] = cube_tmp[25];
        cube[59] = cube_tmp[22];
        cube[60] = cube_tmp[21];
        cube[63] = cube_tmp[18];
        cube[64] = cube_tmp[17];
        cube[65] = cube_tmp[80];
        cube[66] = cube_tmp[79];
        cube[67] = cube_tmp[78];
        cube[68] = cube_tmp[77];
        cube[69] = cube_tmp[76];
        cube[70] = cube_tmp[75];
        cube[71] = cube_tmp[74];
        cube[72] = cube_tmp[73];
        cube[73] = cube_tmp[72];
        cube[74] = cube_tmp[71];
        cube[75] = cube_tmp[70];
        cube[76] = cube_tmp[69];
        cube[77] = cube_tmp[68];
        cube[78] = cube_tmp[67];
        cube[79] = cube_tmp[66];
        cube[80] = cube_tmp[65];
        cube[89] = cube_tmp[8];
        cube[90] = cube_tmp[7];
        cube[91] = cube_tmp[6];
        cube[92] = cube_tmp[5];
        cube[93] = cube_tmp[4];
        cube[94] = cube_tmp[3];
        cube[95] = cube_tmp[2];
        cube[96] = cube_tmp[1];
        break;

    case D:
        cube[29] = cube_tmp[77];
        cube[30] = cube_tmp[78];
        cube[31] = cube_tmp[79];
        cube[32] = cube_tmp[80];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[30];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[32];
        cube[61] = cube_tmp[45];
        cube[62] = cube_tmp[46];
        cube[63] = cube_tmp[47];
        cube[64] = cube_tmp[48];
        cube[77] = cube_tmp[61];
        cube[78] = cube_tmp[62];
        cube[79] = cube_tmp[63];
        cube[80] = cube_tmp[64];
        cube[81] = cube_tmp[93];
        cube[82] = cube_tmp[89];
        cube[83] = cube_tmp[85];
        cube[84] = cube_tmp[81];
        cube[85] = cube_tmp[94];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[86];
        cube[88] = cube_tmp[82];
        cube[89] = cube_tmp[95];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[87];
        cube[92] = cube_tmp[83];
        cube[93] = cube_tmp[96];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[88];
        cube[96] = cube_tmp[84];
        break;

    case D_PRIME:
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[46];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[48];
        cube[45] = cube_tmp[61];
        cube[46] = cube_tmp[62];
        cube[47] = cube_tmp[63];
        cube[48] = cube_tmp[64];
        cube[61] = cube_tmp[77];
        cube[62] = cube_tmp[78];
        cube[63] = cube_tmp[79];
        cube[64] = cube_tmp[80];
        cube[77] = cube_tmp[29];
        cube[78] = cube_tmp[30];
        cube[79] = cube_tmp[31];
        cube[80] = cube_tmp[32];
        cube[81] = cube_tmp[84];
        cube[82] = cube_tmp[88];
        cube[83] = cube_tmp[92];
        cube[84] = cube_tmp[96];
        cube[85] = cube_tmp[83];
        cube[86] = cube_tmp[87];
        cube[87] = cube_tmp[91];
        cube[88] = cube_tmp[95];
        cube[89] = cube_tmp[82];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[81];
        cube[94] = cube_tmp[85];
        cube[95] = cube_tmp[89];
        cube[96] = cube_tmp[93];
        break;

    case D2:
        cube[29] = cube_tmp[61];
        cube[30] = cube_tmp[62];
        cube[31] = cube_tmp[63];
        cube[32] = cube_tmp[64];
        cube[45] = cube_tmp[77];
        cube[46] = cube_tmp[78];
        cube[47] = cube_tmp[79];
        cube[48] = cube_tmp[80];
        cube[61] = cube_tmp[29];
        cube[62] = cube_tmp[30];
        cube[63] = cube_tmp[31];
        cube[64] = cube_tmp[32];
        cube[77] = cube_tmp[45];
        cube[78] = cube_tmp[46];
        cube[79] = cube_tmp[47];
        cube[80] = cube_tmp[48];
        cube[81] = cube_tmp[96];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[94];
        cube[84] = cube_tmp[93];
        cube[85] = cube_tmp[92];
        cube[86] = cube_tmp[91];
        cube[87] = cube_tmp[90];
        cube[88] = cube_tmp[89];
        cube[89] = cube_tmp[88];
        cube[90] = cube_tmp[87];
        cube[91] = cube_tmp[86];
        cube[92] = cube_tmp[85];
        cube[93] = cube_tmp[84];
        cube[94] = cube_tmp[83];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[81];
        break;

    case Dw:
        cube[25] = cube_tmp[73];
        cube[26] = cube_tmp[74];
        cube[27] = cube_tmp[75];
        cube[28] = cube_tmp[76];
        cube[29] = cube_tmp[77];
        cube[30] = cube_tmp[78];
        cube[31] = cube_tmp[79];
        cube[32] = cube_tmp[80];
        cube[41] = cube_tmp[25];
        cube[42] = cube_tmp[26];
        cube[43] = cube_tmp[27];
        cube[44] = cube_tmp[28];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[30];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[32];
        cube[57] = cube_tmp[41];
        cube[58] = cube_tmp[42];
        cube[59] = cube_tmp[43];
        cube[60] = cube_tmp[44];
        cube[61] = cube_tmp[45];
        cube[62] = cube_tmp[46];
        cube[63] = cube_tmp[47];
        cube[64] = cube_tmp[48];
        cube[73] = cube_tmp[57];
        cube[74] = cube_tmp[58];
        cube[75] = cube_tmp[59];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[61];
        cube[78] = cube_tmp[62];
        cube[79] = cube_tmp[63];
        cube[80] = cube_tmp[64];
        cube[81] = cube_tmp[93];
        cube[82] = cube_tmp[89];
        cube[83] = cube_tmp[85];
        cube[84] = cube_tmp[81];
        cube[85] = cube_tmp[94];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[86];
        cube[88] = cube_tmp[82];
        cube[89] = cube_tmp[95];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[87];
        cube[92] = cube_tmp[83];
        cube[93] = cube_tmp[96];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[88];
        cube[96] = cube_tmp[84];
        break;

    case Dw_PRIME:
        cube[25] = cube_tmp[41];
        cube[26] = cube_tmp[42];
        cube[27] = cube_tmp[43];
        cube[28] = cube_tmp[44];
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[46];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[48];
        cube[41] = cube_tmp[57];
        cube[42] = cube_tmp[58];
        cube[43] = cube_tmp[59];
        cube[44] = cube_tmp[60];
        cube[45] = cube_tmp[61];
        cube[46] = cube_tmp[62];
        cube[47] = cube_tmp[63];
        cube[48] = cube_tmp[64];
        cube[57] = cube_tmp[73];
        cube[58] = cube_tmp[74];
        cube[59] = cube_tmp[75];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[77];
        cube[62] = cube_tmp[78];
        cube[63] = cube_tmp[79];
        cube[64] = cube_tmp[80];
        cube[73] = cube_tmp[25];
        cube[74] = cube_tmp[26];
        cube[75] = cube_tmp[27];
        cube[76] = cube_tmp[28];
        cube[77] = cube_tmp[29];
        cube[78] = cube_tmp[30];
        cube[79] = cube_tmp[31];
        cube[80] = cube_tmp[32];
        cube[81] = cube_tmp[84];
        cube[82] = cube_tmp[88];
        cube[83] = cube_tmp[92];
        cube[84] = cube_tmp[96];
        cube[85] = cube_tmp[83];
        cube[86] = cube_tmp[87];
        cube[87] = cube_tmp[91];
        cube[88] = cube_tmp[95];
        cube[89] = cube_tmp[82];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[81];
        cube[94] = cube_tmp[85];
        cube[95] = cube_tmp[89];
        cube[96] = cube_tmp[93];
        break;

    case Dw2:
        cube[25] = cube_tmp[57];
        cube[26] = cube_tmp[58];
        cube[27] = cube_tmp[59];
        cube[28] = cube_tmp[60];
        cube[29] = cube_tmp[61];
        cube[30] = cube_tmp[62];
        cube[31] = cube_tmp[63];
        cube[32] = cube_tmp[64];
        cube[41] = cube_tmp[73];
        cube[42] = cube_tmp[74];
        cube[43] = cube_tmp[75];
        cube[44] = cube_tmp[76];
        cube[45] = cube_tmp[77];
        cube[46] = cube_tmp[78];
        cube[47] = cube_tmp[79];
        cube[48] = cube_tmp[80];
        cube[57] = cube_tmp[25];
        cube[58] = cube_tmp[26];
        cube[59] = cube_tmp[27];
        cube[60] = cube_tmp[28];
        cube[61] = cube_tmp[29];
        cube[62] = cube_tmp[30];
        cube[63] = cube_tmp[31];
        cube[64] = cube_tmp[32];
        cube[73] = cube_tmp[41];
        cube[74] = cube_tmp[42];
        cube[75] = cube_tmp[43];
        cube[76] = cube_tmp[44];
        cube[77] = cube_tmp[45];
        cube[78] = cube_tmp[46];
        cube[79] = cube_tmp[47];
        cube[80] = cube_tmp[48];
        cube[81] = cube_tmp[96];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[94];
        cube[84] = cube_tmp[93];
        cube[85] = cube_tmp[92];
        cube[86] = cube_tmp[91];
        cube[87] = cube_tmp[90];
        cube[88] = cube_tmp[89];
        cube[89] = cube_tmp[88];
        cube[90] = cube_tmp[87];
        cube[91] = cube_tmp[86];
        cube[92] = cube_tmp[85];
        cube[93] = cube_tmp[84];
        cube[94] = cube_tmp[83];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[81];
        break;

    case X:
        cube[1] = cube_tmp[33];
        cube[2] = cube_tmp[34];
        cube[3] = cube_tmp[35];
        cube[4] = cube_tmp[36];
        cube[5] = cube_tmp[37];
        cube[6] = cube_tmp[38];
        cube[7] = cube_tmp[39];
        cube[8] = cube_tmp[40];
        cube[9] = cube_tmp[41];
        cube[10] = cube_tmp[42];
        cube[11] = cube_tmp[43];
        cube[12] = cube_tmp[44];
        cube[13] = cube_tmp[45];
        cube[14] = cube_tmp[46];
        cube[15] = cube_tmp[47];
        cube[16] = cube_tmp[48];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[28];
        cube[20] = cube_tmp[32];
        cube[21] = cube_tmp[19];
        cube[22] = cube_tmp[23];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[31];
        cube[25] = cube_tmp[18];
        cube[26] = cube_tmp[22];
        cube[27] = cube_tmp[26];
        cube[28] = cube_tmp[30];
        cube[29] = cube_tmp[17];
        cube[30] = cube_tmp[21];
        cube[31] = cube_tmp[25];
        cube[32] = cube_tmp[29];
        cube[33] = cube_tmp[81];
        cube[34] = cube_tmp[82];
        cube[35] = cube_tmp[83];
        cube[36] = cube_tmp[84];
        cube[37] = cube_tmp[85];
        cube[38] = cube_tmp[86];
        cube[39] = cube_tmp[87];
        cube[40] = cube_tmp[88];
        cube[41] = cube_tmp[89];
        cube[42] = cube_tmp[90];
        cube[43] = cube_tmp[91];
        cube[44] = cube_tmp[92];
        cube[45] = cube_tmp[93];
        cube[46] = cube_tmp[94];
        cube[47] = cube_tmp[95];
        cube[48] = cube_tmp[96];
        cube[49] = cube_tmp[61];
        cube[50] = cube_tmp[57];
        cube[51] = cube_tmp[53];
        cube[52] = cube_tmp[49];
        cube[53] = cube_tmp[62];
        cube[54] = cube_tmp[58];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[63];
        cube[58] = cube_tmp[59];
        cube[59] = cube_tmp[55];
        cube[60] = cube_tmp[51];
        cube[61] = cube_tmp[64];
        cube[62] = cube_tmp[60];
        cube[63] = cube_tmp[56];
        cube[64] = cube_tmp[52];
        cube[65] = cube_tmp[16];
        cube[66] = cube_tmp[15];
        cube[67] = cube_tmp[14];
        cube[68] = cube_tmp[13];
        cube[69] = cube_tmp[12];
        cube[70] = cube_tmp[11];
        cube[71] = cube_tmp[10];
        cube[72] = cube_tmp[9];
        cube[73] = cube_tmp[8];
        cube[74] = cube_tmp[7];
        cube[75] = cube_tmp[6];
        cube[76] = cube_tmp[5];
        cube[77] = cube_tmp[4];
        cube[78] = cube_tmp[3];
        cube[79] = cube_tmp[2];
        cube[80] = cube_tmp[1];
        cube[81] = cube_tmp[80];
        cube[82] = cube_tmp[79];
        cube[83] = cube_tmp[78];
        cube[84] = cube_tmp[77];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[75];
        cube[87] = cube_tmp[74];
        cube[88] = cube_tmp[73];
        cube[89] = cube_tmp[72];
        cube[90] = cube_tmp[71];
        cube[91] = cube_tmp[70];
        cube[92] = cube_tmp[69];
        cube[93] = cube_tmp[68];
        cube[94] = cube_tmp[67];
        cube[95] = cube_tmp[66];
        cube[96] = cube_tmp[65];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[80];
        cube[2] = cube_tmp[79];
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[77];
        cube[5] = cube_tmp[76];
        cube[6] = cube_tmp[75];
        cube[7] = cube_tmp[74];
        cube[8] = cube_tmp[73];
        cube[9] = cube_tmp[72];
        cube[10] = cube_tmp[71];
        cube[11] = cube_tmp[70];
        cube[12] = cube_tmp[69];
        cube[13] = cube_tmp[68];
        cube[14] = cube_tmp[67];
        cube[15] = cube_tmp[66];
        cube[16] = cube_tmp[65];
        cube[17] = cube_tmp[29];
        cube[18] = cube_tmp[25];
        cube[19] = cube_tmp[21];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[30];
        cube[22] = cube_tmp[26];
        cube[23] = cube_tmp[22];
        cube[24] = cube_tmp[18];
        cube[25] = cube_tmp[31];
        cube[26] = cube_tmp[27];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[19];
        cube[29] = cube_tmp[32];
        cube[30] = cube_tmp[28];
        cube[31] = cube_tmp[24];
        cube[32] = cube_tmp[20];
        cube[33] = cube_tmp[1];
        cube[34] = cube_tmp[2];
        cube[35] = cube_tmp[3];
        cube[36] = cube_tmp[4];
        cube[37] = cube_tmp[5];
        cube[38] = cube_tmp[6];
        cube[39] = cube_tmp[7];
        cube[40] = cube_tmp[8];
        cube[41] = cube_tmp[9];
        cube[42] = cube_tmp[10];
        cube[43] = cube_tmp[11];
        cube[44] = cube_tmp[12];
        cube[45] = cube_tmp[13];
        cube[46] = cube_tmp[14];
        cube[47] = cube_tmp[15];
        cube[48] = cube_tmp[16];
        cube[49] = cube_tmp[52];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[60];
        cube[52] = cube_tmp[64];
        cube[53] = cube_tmp[51];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[59];
        cube[56] = cube_tmp[63];
        cube[57] = cube_tmp[50];
        cube[58] = cube_tmp[54];
        cube[59] = cube_tmp[58];
        cube[60] = cube_tmp[62];
        cube[61] = cube_tmp[49];
        cube[62] = cube_tmp[53];
        cube[63] = cube_tmp[57];
        cube[64] = cube_tmp[61];
        cube[65] = cube_tmp[96];
        cube[66] = cube_tmp[95];
        cube[67] = cube_tmp[94];
        cube[68] = cube_tmp[93];
        cube[69] = cube_tmp[92];
        cube[70] = cube_tmp[91];
        cube[71] = cube_tmp[90];
        cube[72] = cube_tmp[89];
        cube[73] = cube_tmp[88];
        cube[74] = cube_tmp[87];
        cube[75] = cube_tmp[86];
        cube[76] = cube_tmp[85];
        cube[77] = cube_tmp[84];
        cube[78] = cube_tmp[83];
        cube[79] = cube_tmp[82];
        cube[80] = cube_tmp[81];
        cube[81] = cube_tmp[33];
        cube[82] = cube_tmp[34];
        cube[83] = cube_tmp[35];
        cube[84] = cube_tmp[36];
        cube[85] = cube_tmp[37];
        cube[86] = cube_tmp[38];
        cube[87] = cube_tmp[39];
        cube[88] = cube_tmp[40];
        cube[89] = cube_tmp[41];
        cube[90] = cube_tmp[42];
        cube[91] = cube_tmp[43];
        cube[92] = cube_tmp[44];
        cube[93] = cube_tmp[45];
        cube[94] = cube_tmp[46];
        cube[95] = cube_tmp[47];
        cube[96] = cube_tmp[48];
        break;

    case Y:
        cube[1] = cube_tmp[13];
        cube[2] = cube_tmp[9];
        cube[3] = cube_tmp[5];
        cube[4] = cube_tmp[1];
        cube[5] = cube_tmp[14];
        cube[6] = cube_tmp[10];
        cube[7] = cube_tmp[6];
        cube[8] = cube_tmp[2];
        cube[9] = cube_tmp[15];
        cube[10] = cube_tmp[11];
        cube[11] = cube_tmp[7];
        cube[12] = cube_tmp[3];
        cube[13] = cube_tmp[16];
        cube[14] = cube_tmp[12];
        cube[15] = cube_tmp[8];
        cube[16] = cube_tmp[4];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[35];
        cube[20] = cube_tmp[36];
        cube[21] = cube_tmp[37];
        cube[22] = cube_tmp[38];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[40];
        cube[25] = cube_tmp[41];
        cube[26] = cube_tmp[42];
        cube[27] = cube_tmp[43];
        cube[28] = cube_tmp[44];
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[46];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[48];
        cube[33] = cube_tmp[49];
        cube[34] = cube_tmp[50];
        cube[35] = cube_tmp[51];
        cube[36] = cube_tmp[52];
        cube[37] = cube_tmp[53];
        cube[38] = cube_tmp[54];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[56];
        cube[41] = cube_tmp[57];
        cube[42] = cube_tmp[58];
        cube[43] = cube_tmp[59];
        cube[44] = cube_tmp[60];
        cube[45] = cube_tmp[61];
        cube[46] = cube_tmp[62];
        cube[47] = cube_tmp[63];
        cube[48] = cube_tmp[64];
        cube[49] = cube_tmp[65];
        cube[50] = cube_tmp[66];
        cube[51] = cube_tmp[67];
        cube[52] = cube_tmp[68];
        cube[53] = cube_tmp[69];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[71];
        cube[56] = cube_tmp[72];
        cube[57] = cube_tmp[73];
        cube[58] = cube_tmp[74];
        cube[59] = cube_tmp[75];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[77];
        cube[62] = cube_tmp[78];
        cube[63] = cube_tmp[79];
        cube[64] = cube_tmp[80];
        cube[65] = cube_tmp[17];
        cube[66] = cube_tmp[18];
        cube[67] = cube_tmp[19];
        cube[68] = cube_tmp[20];
        cube[69] = cube_tmp[21];
        cube[70] = cube_tmp[22];
        cube[71] = cube_tmp[23];
        cube[72] = cube_tmp[24];
        cube[73] = cube_tmp[25];
        cube[74] = cube_tmp[26];
        cube[75] = cube_tmp[27];
        cube[76] = cube_tmp[28];
        cube[77] = cube_tmp[29];
        cube[78] = cube_tmp[30];
        cube[79] = cube_tmp[31];
        cube[80] = cube_tmp[32];
        cube[81] = cube_tmp[84];
        cube[82] = cube_tmp[88];
        cube[83] = cube_tmp[92];
        cube[84] = cube_tmp[96];
        cube[85] = cube_tmp[83];
        cube[86] = cube_tmp[87];
        cube[87] = cube_tmp[91];
        cube[88] = cube_tmp[95];
        cube[89] = cube_tmp[82];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[81];
        cube[94] = cube_tmp[85];
        cube[95] = cube_tmp[89];
        cube[96] = cube_tmp[93];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[4];
        cube[2] = cube_tmp[8];
        cube[3] = cube_tmp[12];
        cube[4] = cube_tmp[16];
        cube[5] = cube_tmp[3];
        cube[6] = cube_tmp[7];
        cube[7] = cube_tmp[11];
        cube[8] = cube_tmp[15];
        cube[9] = cube_tmp[2];
        cube[10] = cube_tmp[6];
        cube[11] = cube_tmp[10];
        cube[12] = cube_tmp[14];
        cube[13] = cube_tmp[1];
        cube[14] = cube_tmp[5];
        cube[15] = cube_tmp[9];
        cube[16] = cube_tmp[13];
        cube[17] = cube_tmp[65];
        cube[18] = cube_tmp[66];
        cube[19] = cube_tmp[67];
        cube[20] = cube_tmp[68];
        cube[21] = cube_tmp[69];
        cube[22] = cube_tmp[70];
        cube[23] = cube_tmp[71];
        cube[24] = cube_tmp[72];
        cube[25] = cube_tmp[73];
        cube[26] = cube_tmp[74];
        cube[27] = cube_tmp[75];
        cube[28] = cube_tmp[76];
        cube[29] = cube_tmp[77];
        cube[30] = cube_tmp[78];
        cube[31] = cube_tmp[79];
        cube[32] = cube_tmp[80];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[19];
        cube[36] = cube_tmp[20];
        cube[37] = cube_tmp[21];
        cube[38] = cube_tmp[22];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[24];
        cube[41] = cube_tmp[25];
        cube[42] = cube_tmp[26];
        cube[43] = cube_tmp[27];
        cube[44] = cube_tmp[28];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[30];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[32];
        cube[49] = cube_tmp[33];
        cube[50] = cube_tmp[34];
        cube[51] = cube_tmp[35];
        cube[52] = cube_tmp[36];
        cube[53] = cube_tmp[37];
        cube[54] = cube_tmp[38];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[40];
        cube[57] = cube_tmp[41];
        cube[58] = cube_tmp[42];
        cube[59] = cube_tmp[43];
        cube[60] = cube_tmp[44];
        cube[61] = cube_tmp[45];
        cube[62] = cube_tmp[46];
        cube[63] = cube_tmp[47];
        cube[64] = cube_tmp[48];
        cube[65] = cube_tmp[49];
        cube[66] = cube_tmp[50];
        cube[67] = cube_tmp[51];
        cube[68] = cube_tmp[52];
        cube[69] = cube_tmp[53];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[55];
        cube[72] = cube_tmp[56];
        cube[73] = cube_tmp[57];
        cube[74] = cube_tmp[58];
        cube[75] = cube_tmp[59];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[61];
        cube[78] = cube_tmp[62];
        cube[79] = cube_tmp[63];
        cube[80] = cube_tmp[64];
        cube[81] = cube_tmp[93];
        cube[82] = cube_tmp[89];
        cube[83] = cube_tmp[85];
        cube[84] = cube_tmp[81];
        cube[85] = cube_tmp[94];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[86];
        cube[88] = cube_tmp[82];
        cube[89] = cube_tmp[95];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[87];
        cube[92] = cube_tmp[83];
        cube[93] = cube_tmp[96];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[88];
        cube[96] = cube_tmp[84];
        break;

    case Z:
        cube[1] = cube_tmp[29];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[17];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[26];
        cube[7] = cube_tmp[22];
        cube[8] = cube_tmp[18];
        cube[9] = cube_tmp[31];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[19];
        cube[13] = cube_tmp[32];
        cube[14] = cube_tmp[28];
        cube[15] = cube_tmp[24];
        cube[16] = cube_tmp[20];
        cube[17] = cube_tmp[93];
        cube[18] = cube_tmp[89];
        cube[19] = cube_tmp[85];
        cube[20] = cube_tmp[81];
        cube[21] = cube_tmp[94];
        cube[22] = cube_tmp[90];
        cube[23] = cube_tmp[86];
        cube[24] = cube_tmp[82];
        cube[25] = cube_tmp[95];
        cube[26] = cube_tmp[91];
        cube[27] = cube_tmp[87];
        cube[28] = cube_tmp[83];
        cube[29] = cube_tmp[96];
        cube[30] = cube_tmp[92];
        cube[31] = cube_tmp[88];
        cube[32] = cube_tmp[84];
        cube[33] = cube_tmp[45];
        cube[34] = cube_tmp[41];
        cube[35] = cube_tmp[37];
        cube[36] = cube_tmp[33];
        cube[37] = cube_tmp[46];
        cube[38] = cube_tmp[42];
        cube[39] = cube_tmp[38];
        cube[40] = cube_tmp[34];
        cube[41] = cube_tmp[47];
        cube[42] = cube_tmp[43];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[35];
        cube[45] = cube_tmp[48];
        cube[46] = cube_tmp[44];
        cube[47] = cube_tmp[40];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[13];
        cube[50] = cube_tmp[9];
        cube[51] = cube_tmp[5];
        cube[52] = cube_tmp[1];
        cube[53] = cube_tmp[14];
        cube[54] = cube_tmp[10];
        cube[55] = cube_tmp[6];
        cube[56] = cube_tmp[2];
        cube[57] = cube_tmp[15];
        cube[58] = cube_tmp[11];
        cube[59] = cube_tmp[7];
        cube[60] = cube_tmp[3];
        cube[61] = cube_tmp[16];
        cube[62] = cube_tmp[12];
        cube[63] = cube_tmp[8];
        cube[64] = cube_tmp[4];
        cube[65] = cube_tmp[68];
        cube[66] = cube_tmp[72];
        cube[67] = cube_tmp[76];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[71];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[79];
        cube[73] = cube_tmp[66];
        cube[74] = cube_tmp[70];
        cube[75] = cube_tmp[74];
        cube[76] = cube_tmp[78];
        cube[77] = cube_tmp[65];
        cube[78] = cube_tmp[69];
        cube[79] = cube_tmp[73];
        cube[80] = cube_tmp[77];
        cube[81] = cube_tmp[61];
        cube[82] = cube_tmp[57];
        cube[83] = cube_tmp[53];
        cube[84] = cube_tmp[49];
        cube[85] = cube_tmp[62];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[54];
        cube[88] = cube_tmp[50];
        cube[89] = cube_tmp[63];
        cube[90] = cube_tmp[59];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[51];
        cube[93] = cube_tmp[64];
        cube[94] = cube_tmp[60];
        cube[95] = cube_tmp[56];
        cube[96] = cube_tmp[52];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[52];
        cube[2] = cube_tmp[56];
        cube[3] = cube_tmp[60];
        cube[4] = cube_tmp[64];
        cube[5] = cube_tmp[51];
        cube[6] = cube_tmp[55];
        cube[7] = cube_tmp[59];
        cube[8] = cube_tmp[63];
        cube[9] = cube_tmp[50];
        cube[10] = cube_tmp[54];
        cube[11] = cube_tmp[58];
        cube[12] = cube_tmp[62];
        cube[13] = cube_tmp[49];
        cube[14] = cube_tmp[53];
        cube[15] = cube_tmp[57];
        cube[16] = cube_tmp[61];
        cube[17] = cube_tmp[4];
        cube[18] = cube_tmp[8];
        cube[19] = cube_tmp[12];
        cube[20] = cube_tmp[16];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[7];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[15];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[6];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[14];
        cube[29] = cube_tmp[1];
        cube[30] = cube_tmp[5];
        cube[31] = cube_tmp[9];
        cube[32] = cube_tmp[13];
        cube[33] = cube_tmp[36];
        cube[34] = cube_tmp[40];
        cube[35] = cube_tmp[44];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[35];
        cube[38] = cube_tmp[39];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[47];
        cube[41] = cube_tmp[34];
        cube[42] = cube_tmp[38];
        cube[43] = cube_tmp[42];
        cube[44] = cube_tmp[46];
        cube[45] = cube_tmp[33];
        cube[46] = cube_tmp[37];
        cube[47] = cube_tmp[41];
        cube[48] = cube_tmp[45];
        cube[49] = cube_tmp[84];
        cube[50] = cube_tmp[88];
        cube[51] = cube_tmp[92];
        cube[52] = cube_tmp[96];
        cube[53] = cube_tmp[83];
        cube[54] = cube_tmp[87];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[95];
        cube[57] = cube_tmp[82];
        cube[58] = cube_tmp[86];
        cube[59] = cube_tmp[90];
        cube[60] = cube_tmp[94];
        cube[61] = cube_tmp[81];
        cube[62] = cube_tmp[85];
        cube[63] = cube_tmp[89];
        cube[64] = cube_tmp[93];
        cube[65] = cube_tmp[77];
        cube[66] = cube_tmp[73];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[65];
        cube[69] = cube_tmp[78];
        cube[70] = cube_tmp[74];
        cube[71] = cube_tmp[70];
        cube[72] = cube_tmp[66];
        cube[73] = cube_tmp[79];
        cube[74] = cube_tmp[75];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[67];
        cube[77] = cube_tmp[80];
        cube[78] = cube_tmp[76];
        cube[79] = cube_tmp[72];
        cube[80] = cube_tmp[68];
        cube[81] = cube_tmp[20];
        cube[82] = cube_tmp[24];
        cube[83] = cube_tmp[28];
        cube[84] = cube_tmp[32];
        cube[85] = cube_tmp[19];
        cube[86] = cube_tmp[23];
        cube[87] = cube_tmp[27];
        cube[88] = cube_tmp[31];
        cube[89] = cube_tmp[18];
        cube[90] = cube_tmp[22];
        cube[91] = cube_tmp[26];
        cube[92] = cube_tmp[30];
        cube[93] = cube_tmp[17];
        cube[94] = cube_tmp[21];
        cube[95] = cube_tmp[25];
        cube[96] = cube_tmp[29];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

void
rotate_555(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[21];
        cube[2] = cube_tmp[16];
        cube[3] = cube_tmp[11];
        cube[4] = cube_tmp[6];
        cube[5] = cube_tmp[1];
        cube[6] = cube_tmp[22];
        cube[7] = cube_tmp[17];
        cube[8] = cube_tmp[12];
        cube[9] = cube_tmp[7];
        cube[10] = cube_tmp[2];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[18];
        cube[14] = cube_tmp[8];
        cube[15] = cube_tmp[3];
        cube[16] = cube_tmp[24];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[14];
        cube[19] = cube_tmp[9];
        cube[20] = cube_tmp[4];
        cube[21] = cube_tmp[25];
        cube[22] = cube_tmp[20];
        cube[23] = cube_tmp[15];
        cube[24] = cube_tmp[10];
        cube[25] = cube_tmp[5];
        cube[26] = cube_tmp[51];
        cube[27] = cube_tmp[52];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[54];
        cube[30] = cube_tmp[55];
        cube[51] = cube_tmp[76];
        cube[52] = cube_tmp[77];
        cube[53] = cube_tmp[78];
        cube[54] = cube_tmp[79];
        cube[55] = cube_tmp[80];
        cube[76] = cube_tmp[101];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[105];
        cube[101] = cube_tmp[26];
        cube[102] = cube_tmp[27];
        cube[103] = cube_tmp[28];
        cube[104] = cube_tmp[29];
        cube[105] = cube_tmp[30];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[5];
        cube[2] = cube_tmp[10];
        cube[3] = cube_tmp[15];
        cube[4] = cube_tmp[20];
        cube[5] = cube_tmp[25];
        cube[6] = cube_tmp[4];
        cube[7] = cube_tmp[9];
        cube[8] = cube_tmp[14];
        cube[9] = cube_tmp[19];
        cube[10] = cube_tmp[24];
        cube[11] = cube_tmp[3];
        cube[12] = cube_tmp[8];
        cube[14] = cube_tmp[18];
        cube[15] = cube_tmp[23];
        cube[16] = cube_tmp[2];
        cube[17] = cube_tmp[7];
        cube[18] = cube_tmp[12];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[22];
        cube[21] = cube_tmp[1];
        cube[22] = cube_tmp[6];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[16];
        cube[25] = cube_tmp[21];
        cube[26] = cube_tmp[101];
        cube[27] = cube_tmp[102];
        cube[28] = cube_tmp[103];
        cube[29] = cube_tmp[104];
        cube[30] = cube_tmp[105];
        cube[51] = cube_tmp[26];
        cube[52] = cube_tmp[27];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[29];
        cube[55] = cube_tmp[30];
        cube[76] = cube_tmp[51];
        cube[77] = cube_tmp[52];
        cube[78] = cube_tmp[53];
        cube[79] = cube_tmp[54];
        cube[80] = cube_tmp[55];
        cube[101] = cube_tmp[76];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[80];
        break;

    case U2:
        cube[1] = cube_tmp[25];
        cube[2] = cube_tmp[24];
        cube[3] = cube_tmp[23];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[21];
        cube[6] = cube_tmp[20];
        cube[7] = cube_tmp[19];
        cube[8] = cube_tmp[18];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[16];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[14];
        cube[14] = cube_tmp[12];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[10];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[8];
        cube[19] = cube_tmp[7];
        cube[20] = cube_tmp[6];
        cube[21] = cube_tmp[5];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[3];
        cube[24] = cube_tmp[2];
        cube[25] = cube_tmp[1];
        cube[26] = cube_tmp[76];
        cube[27] = cube_tmp[77];
        cube[28] = cube_tmp[78];
        cube[29] = cube_tmp[79];
        cube[30] = cube_tmp[80];
        cube[51] = cube_tmp[101];
        cube[52] = cube_tmp[102];
        cube[53] = cube_tmp[103];
        cube[54] = cube_tmp[104];
        cube[55] = cube_tmp[105];
        cube[76] = cube_tmp[26];
        cube[77] = cube_tmp[27];
        cube[78] = cube_tmp[28];
        cube[79] = cube_tmp[29];
        cube[80] = cube_tmp[30];
        cube[101] = cube_tmp[51];
        cube[102] = cube_tmp[52];
        cube[103] = cube_tmp[53];
        cube[104] = cube_tmp[54];
        cube[105] = cube_tmp[55];
        break;

    case Uw:
        cube[1] = cube_tmp[21];
        cube[2] = cube_tmp[16];
        cube[3] = cube_tmp[11];
        cube[4] = cube_tmp[6];
        cube[5] = cube_tmp[1];
        cube[6] = cube_tmp[22];
        cube[7] = cube_tmp[17];
        cube[8] = cube_tmp[12];
        cube[9] = cube_tmp[7];
        cube[10] = cube_tmp[2];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[18];
        cube[14] = cube_tmp[8];
        cube[15] = cube_tmp[3];
        cube[16] = cube_tmp[24];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[14];
        cube[19] = cube_tmp[9];
        cube[20] = cube_tmp[4];
        cube[21] = cube_tmp[25];
        cube[22] = cube_tmp[20];
        cube[23] = cube_tmp[15];
        cube[24] = cube_tmp[10];
        cube[25] = cube_tmp[5];
        cube[26] = cube_tmp[51];
        cube[27] = cube_tmp[52];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[54];
        cube[30] = cube_tmp[55];
        cube[31] = cube_tmp[56];
        cube[32] = cube_tmp[57];
        cube[33] = cube_tmp[58];
        cube[34] = cube_tmp[59];
        cube[35] = cube_tmp[60];
        cube[51] = cube_tmp[76];
        cube[52] = cube_tmp[77];
        cube[53] = cube_tmp[78];
        cube[54] = cube_tmp[79];
        cube[55] = cube_tmp[80];
        cube[56] = cube_tmp[81];
        cube[57] = cube_tmp[82];
        cube[58] = cube_tmp[83];
        cube[59] = cube_tmp[84];
        cube[60] = cube_tmp[85];
        cube[76] = cube_tmp[101];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[105];
        cube[81] = cube_tmp[106];
        cube[82] = cube_tmp[107];
        cube[83] = cube_tmp[108];
        cube[84] = cube_tmp[109];
        cube[85] = cube_tmp[110];
        cube[101] = cube_tmp[26];
        cube[102] = cube_tmp[27];
        cube[103] = cube_tmp[28];
        cube[104] = cube_tmp[29];
        cube[105] = cube_tmp[30];
        cube[106] = cube_tmp[31];
        cube[107] = cube_tmp[32];
        cube[108] = cube_tmp[33];
        cube[109] = cube_tmp[34];
        cube[110] = cube_tmp[35];
        break;

    case Uw_PRIME:
        cube[1] = cube_tmp[5];
        cube[2] = cube_tmp[10];
        cube[3] = cube_tmp[15];
        cube[4] = cube_tmp[20];
        cube[5] = cube_tmp[25];
        cube[6] = cube_tmp[4];
        cube[7] = cube_tmp[9];
        cube[8] = cube_tmp[14];
        cube[9] = cube_tmp[19];
        cube[10] = cube_tmp[24];
        cube[11] = cube_tmp[3];
        cube[12] = cube_tmp[8];
        cube[14] = cube_tmp[18];
        cube[15] = cube_tmp[23];
        cube[16] = cube_tmp[2];
        cube[17] = cube_tmp[7];
        cube[18] = cube_tmp[12];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[22];
        cube[21] = cube_tmp[1];
        cube[22] = cube_tmp[6];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[16];
        cube[25] = cube_tmp[21];
        cube[26] = cube_tmp[101];
        cube[27] = cube_tmp[102];
        cube[28] = cube_tmp[103];
        cube[29] = cube_tmp[104];
        cube[30] = cube_tmp[105];
        cube[31] = cube_tmp[106];
        cube[32] = cube_tmp[107];
        cube[33] = cube_tmp[108];
        cube[34] = cube_tmp[109];
        cube[35] = cube_tmp[110];
        cube[51] = cube_tmp[26];
        cube[52] = cube_tmp[27];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[29];
        cube[55] = cube_tmp[30];
        cube[56] = cube_tmp[31];
        cube[57] = cube_tmp[32];
        cube[58] = cube_tmp[33];
        cube[59] = cube_tmp[34];
        cube[60] = cube_tmp[35];
        cube[76] = cube_tmp[51];
        cube[77] = cube_tmp[52];
        cube[78] = cube_tmp[53];
        cube[79] = cube_tmp[54];
        cube[80] = cube_tmp[55];
        cube[81] = cube_tmp[56];
        cube[82] = cube_tmp[57];
        cube[83] = cube_tmp[58];
        cube[84] = cube_tmp[59];
        cube[85] = cube_tmp[60];
        cube[101] = cube_tmp[76];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[80];
        cube[106] = cube_tmp[81];
        cube[107] = cube_tmp[82];
        cube[108] = cube_tmp[83];
        cube[109] = cube_tmp[84];
        cube[110] = cube_tmp[85];
        break;

    case Uw2:
        cube[1] = cube_tmp[25];
        cube[2] = cube_tmp[24];
        cube[3] = cube_tmp[23];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[21];
        cube[6] = cube_tmp[20];
        cube[7] = cube_tmp[19];
        cube[8] = cube_tmp[18];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[16];
        cube[11] = cube_tmp[15];
        cube[12] = cube_tmp[14];
        cube[14] = cube_tmp[12];
        cube[15] = cube_tmp[11];
        cube[16] = cube_tmp[10];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[8];
        cube[19] = cube_tmp[7];
        cube[20] = cube_tmp[6];
        cube[21] = cube_tmp[5];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[3];
        cube[24] = cube_tmp[2];
        cube[25] = cube_tmp[1];
        cube[26] = cube_tmp[76];
        cube[27] = cube_tmp[77];
        cube[28] = cube_tmp[78];
        cube[29] = cube_tmp[79];
        cube[30] = cube_tmp[80];
        cube[31] = cube_tmp[81];
        cube[32] = cube_tmp[82];
        cube[33] = cube_tmp[83];
        cube[34] = cube_tmp[84];
        cube[35] = cube_tmp[85];
        cube[51] = cube_tmp[101];
        cube[52] = cube_tmp[102];
        cube[53] = cube_tmp[103];
        cube[54] = cube_tmp[104];
        cube[55] = cube_tmp[105];
        cube[56] = cube_tmp[106];
        cube[57] = cube_tmp[107];
        cube[58] = cube_tmp[108];
        cube[59] = cube_tmp[109];
        cube[60] = cube_tmp[110];
        cube[76] = cube_tmp[26];
        cube[77] = cube_tmp[27];
        cube[78] = cube_tmp[28];
        cube[79] = cube_tmp[29];
        cube[80] = cube_tmp[30];
        cube[81] = cube_tmp[31];
        cube[82] = cube_tmp[32];
        cube[83] = cube_tmp[33];
        cube[84] = cube_tmp[34];
        cube[85] = cube_tmp[35];
        cube[101] = cube_tmp[51];
        cube[102] = cube_tmp[52];
        cube[103] = cube_tmp[53];
        cube[104] = cube_tmp[54];
        cube[105] = cube_tmp[55];
        cube[106] = cube_tmp[56];
        cube[107] = cube_tmp[57];
        cube[108] = cube_tmp[58];
        cube[109] = cube_tmp[59];
        cube[110] = cube_tmp[60];
        break;

    case L:
        cube[1] = cube_tmp[125];
        cube[6] = cube_tmp[120];
        cube[11] = cube_tmp[115];
        cube[16] = cube_tmp[110];
        cube[21] = cube_tmp[105];
        cube[26] = cube_tmp[46];
        cube[27] = cube_tmp[41];
        cube[28] = cube_tmp[36];
        cube[29] = cube_tmp[31];
        cube[30] = cube_tmp[26];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[42];
        cube[33] = cube_tmp[37];
        cube[34] = cube_tmp[32];
        cube[35] = cube_tmp[27];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[43];
        cube[39] = cube_tmp[33];
        cube[40] = cube_tmp[28];
        cube[41] = cube_tmp[49];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[34];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[45];
        cube[48] = cube_tmp[40];
        cube[49] = cube_tmp[35];
        cube[50] = cube_tmp[30];
        cube[51] = cube_tmp[1];
        cube[56] = cube_tmp[6];
        cube[61] = cube_tmp[11];
        cube[66] = cube_tmp[16];
        cube[71] = cube_tmp[21];
        cube[105] = cube_tmp[146];
        cube[110] = cube_tmp[141];
        cube[115] = cube_tmp[136];
        cube[120] = cube_tmp[131];
        cube[125] = cube_tmp[126];
        cube[126] = cube_tmp[51];
        cube[131] = cube_tmp[56];
        cube[136] = cube_tmp[61];
        cube[141] = cube_tmp[66];
        cube[146] = cube_tmp[71];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[51];
        cube[6] = cube_tmp[56];
        cube[11] = cube_tmp[61];
        cube[16] = cube_tmp[66];
        cube[21] = cube_tmp[71];
        cube[26] = cube_tmp[30];
        cube[27] = cube_tmp[35];
        cube[28] = cube_tmp[40];
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[50];
        cube[31] = cube_tmp[29];
        cube[32] = cube_tmp[34];
        cube[33] = cube_tmp[39];
        cube[34] = cube_tmp[44];
        cube[35] = cube_tmp[49];
        cube[36] = cube_tmp[28];
        cube[37] = cube_tmp[33];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[48];
        cube[41] = cube_tmp[27];
        cube[42] = cube_tmp[32];
        cube[43] = cube_tmp[37];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[47];
        cube[46] = cube_tmp[26];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[41];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[126];
        cube[56] = cube_tmp[131];
        cube[61] = cube_tmp[136];
        cube[66] = cube_tmp[141];
        cube[71] = cube_tmp[146];
        cube[105] = cube_tmp[21];
        cube[110] = cube_tmp[16];
        cube[115] = cube_tmp[11];
        cube[120] = cube_tmp[6];
        cube[125] = cube_tmp[1];
        cube[126] = cube_tmp[125];
        cube[131] = cube_tmp[120];
        cube[136] = cube_tmp[115];
        cube[141] = cube_tmp[110];
        cube[146] = cube_tmp[105];
        break;

    case L2:
        cube[1] = cube_tmp[126];
        cube[6] = cube_tmp[131];
        cube[11] = cube_tmp[136];
        cube[16] = cube_tmp[141];
        cube[21] = cube_tmp[146];
        cube[26] = cube_tmp[50];
        cube[27] = cube_tmp[49];
        cube[28] = cube_tmp[48];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[46];
        cube[31] = cube_tmp[45];
        cube[32] = cube_tmp[44];
        cube[33] = cube_tmp[43];
        cube[34] = cube_tmp[42];
        cube[35] = cube_tmp[41];
        cube[36] = cube_tmp[40];
        cube[37] = cube_tmp[39];
        cube[39] = cube_tmp[37];
        cube[40] = cube_tmp[36];
        cube[41] = cube_tmp[35];
        cube[42] = cube_tmp[34];
        cube[43] = cube_tmp[33];
        cube[44] = cube_tmp[32];
        cube[45] = cube_tmp[31];
        cube[46] = cube_tmp[30];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[28];
        cube[49] = cube_tmp[27];
        cube[50] = cube_tmp[26];
        cube[51] = cube_tmp[125];
        cube[56] = cube_tmp[120];
        cube[61] = cube_tmp[115];
        cube[66] = cube_tmp[110];
        cube[71] = cube_tmp[105];
        cube[105] = cube_tmp[71];
        cube[110] = cube_tmp[66];
        cube[115] = cube_tmp[61];
        cube[120] = cube_tmp[56];
        cube[125] = cube_tmp[51];
        cube[126] = cube_tmp[1];
        cube[131] = cube_tmp[6];
        cube[136] = cube_tmp[11];
        cube[141] = cube_tmp[16];
        cube[146] = cube_tmp[21];
        break;

    case Lw:
        cube[1] = cube_tmp[125];
        cube[2] = cube_tmp[124];
        cube[6] = cube_tmp[120];
        cube[7] = cube_tmp[119];
        cube[11] = cube_tmp[115];
        cube[12] = cube_tmp[114];
        cube[16] = cube_tmp[110];
        cube[17] = cube_tmp[109];
        cube[21] = cube_tmp[105];
        cube[22] = cube_tmp[104];
        cube[26] = cube_tmp[46];
        cube[27] = cube_tmp[41];
        cube[28] = cube_tmp[36];
        cube[29] = cube_tmp[31];
        cube[30] = cube_tmp[26];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[42];
        cube[33] = cube_tmp[37];
        cube[34] = cube_tmp[32];
        cube[35] = cube_tmp[27];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[43];
        cube[39] = cube_tmp[33];
        cube[40] = cube_tmp[28];
        cube[41] = cube_tmp[49];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[34];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[45];
        cube[48] = cube_tmp[40];
        cube[49] = cube_tmp[35];
        cube[50] = cube_tmp[30];
        cube[51] = cube_tmp[1];
        cube[52] = cube_tmp[2];
        cube[56] = cube_tmp[6];
        cube[57] = cube_tmp[7];
        cube[61] = cube_tmp[11];
        cube[62] = cube_tmp[12];
        cube[66] = cube_tmp[16];
        cube[67] = cube_tmp[17];
        cube[71] = cube_tmp[21];
        cube[72] = cube_tmp[22];
        cube[104] = cube_tmp[147];
        cube[105] = cube_tmp[146];
        cube[109] = cube_tmp[142];
        cube[110] = cube_tmp[141];
        cube[114] = cube_tmp[137];
        cube[115] = cube_tmp[136];
        cube[119] = cube_tmp[132];
        cube[120] = cube_tmp[131];
        cube[124] = cube_tmp[127];
        cube[125] = cube_tmp[126];
        cube[126] = cube_tmp[51];
        cube[127] = cube_tmp[52];
        cube[131] = cube_tmp[56];
        cube[132] = cube_tmp[57];
        cube[136] = cube_tmp[61];
        cube[137] = cube_tmp[62];
        cube[141] = cube_tmp[66];
        cube[142] = cube_tmp[67];
        cube[146] = cube_tmp[71];
        cube[147] = cube_tmp[72];
        break;

    case Lw_PRIME:
        cube[1] = cube_tmp[51];
        cube[2] = cube_tmp[52];
        cube[6] = cube_tmp[56];
        cube[7] = cube_tmp[57];
        cube[11] = cube_tmp[61];
        cube[12] = cube_tmp[62];
        cube[16] = cube_tmp[66];
        cube[17] = cube_tmp[67];
        cube[21] = cube_tmp[71];
        cube[22] = cube_tmp[72];
        cube[26] = cube_tmp[30];
        cube[27] = cube_tmp[35];
        cube[28] = cube_tmp[40];
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[50];
        cube[31] = cube_tmp[29];
        cube[32] = cube_tmp[34];
        cube[33] = cube_tmp[39];
        cube[34] = cube_tmp[44];
        cube[35] = cube_tmp[49];
        cube[36] = cube_tmp[28];
        cube[37] = cube_tmp[33];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[48];
        cube[41] = cube_tmp[27];
        cube[42] = cube_tmp[32];
        cube[43] = cube_tmp[37];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[47];
        cube[46] = cube_tmp[26];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[41];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[126];
        cube[52] = cube_tmp[127];
        cube[56] = cube_tmp[131];
        cube[57] = cube_tmp[132];
        cube[61] = cube_tmp[136];
        cube[62] = cube_tmp[137];
        cube[66] = cube_tmp[141];
        cube[67] = cube_tmp[142];
        cube[71] = cube_tmp[146];
        cube[72] = cube_tmp[147];
        cube[104] = cube_tmp[22];
        cube[105] = cube_tmp[21];
        cube[109] = cube_tmp[17];
        cube[110] = cube_tmp[16];
        cube[114] = cube_tmp[12];
        cube[115] = cube_tmp[11];
        cube[119] = cube_tmp[7];
        cube[120] = cube_tmp[6];
        cube[124] = cube_tmp[2];
        cube[125] = cube_tmp[1];
        cube[126] = cube_tmp[125];
        cube[127] = cube_tmp[124];
        cube[131] = cube_tmp[120];
        cube[132] = cube_tmp[119];
        cube[136] = cube_tmp[115];
        cube[137] = cube_tmp[114];
        cube[141] = cube_tmp[110];
        cube[142] = cube_tmp[109];
        cube[146] = cube_tmp[105];
        cube[147] = cube_tmp[104];
        break;

    case Lw2:
        cube[1] = cube_tmp[126];
        cube[2] = cube_tmp[127];
        cube[6] = cube_tmp[131];
        cube[7] = cube_tmp[132];
        cube[11] = cube_tmp[136];
        cube[12] = cube_tmp[137];
        cube[16] = cube_tmp[141];
        cube[17] = cube_tmp[142];
        cube[21] = cube_tmp[146];
        cube[22] = cube_tmp[147];
        cube[26] = cube_tmp[50];
        cube[27] = cube_tmp[49];
        cube[28] = cube_tmp[48];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[46];
        cube[31] = cube_tmp[45];
        cube[32] = cube_tmp[44];
        cube[33] = cube_tmp[43];
        cube[34] = cube_tmp[42];
        cube[35] = cube_tmp[41];
        cube[36] = cube_tmp[40];
        cube[37] = cube_tmp[39];
        cube[39] = cube_tmp[37];
        cube[40] = cube_tmp[36];
        cube[41] = cube_tmp[35];
        cube[42] = cube_tmp[34];
        cube[43] = cube_tmp[33];
        cube[44] = cube_tmp[32];
        cube[45] = cube_tmp[31];
        cube[46] = cube_tmp[30];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[28];
        cube[49] = cube_tmp[27];
        cube[50] = cube_tmp[26];
        cube[51] = cube_tmp[125];
        cube[52] = cube_tmp[124];
        cube[56] = cube_tmp[120];
        cube[57] = cube_tmp[119];
        cube[61] = cube_tmp[115];
        cube[62] = cube_tmp[114];
        cube[66] = cube_tmp[110];
        cube[67] = cube_tmp[109];
        cube[71] = cube_tmp[105];
        cube[72] = cube_tmp[104];
        cube[104] = cube_tmp[72];
        cube[105] = cube_tmp[71];
        cube[109] = cube_tmp[67];
        cube[110] = cube_tmp[66];
        cube[114] = cube_tmp[62];
        cube[115] = cube_tmp[61];
        cube[119] = cube_tmp[57];
        cube[120] = cube_tmp[56];
        cube[124] = cube_tmp[52];
        cube[125] = cube_tmp[51];
        cube[126] = cube_tmp[1];
        cube[127] = cube_tmp[2];
        cube[131] = cube_tmp[6];
        cube[132] = cube_tmp[7];
        cube[136] = cube_tmp[11];
        cube[137] = cube_tmp[12];
        cube[141] = cube_tmp[16];
        cube[142] = cube_tmp[17];
        cube[146] = cube_tmp[21];
        cube[147] = cube_tmp[22];
        break;

    case F:
        cube[21] = cube_tmp[50];
        cube[22] = cube_tmp[45];
        cube[23] = cube_tmp[40];
        cube[24] = cube_tmp[35];
        cube[25] = cube_tmp[30];
        cube[30] = cube_tmp[126];
        cube[35] = cube_tmp[127];
        cube[40] = cube_tmp[128];
        cube[45] = cube_tmp[129];
        cube[50] = cube_tmp[130];
        cube[51] = cube_tmp[71];
        cube[52] = cube_tmp[66];
        cube[53] = cube_tmp[61];
        cube[54] = cube_tmp[56];
        cube[55] = cube_tmp[51];
        cube[56] = cube_tmp[72];
        cube[57] = cube_tmp[67];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[57];
        cube[60] = cube_tmp[52];
        cube[61] = cube_tmp[73];
        cube[62] = cube_tmp[68];
        cube[64] = cube_tmp[58];
        cube[65] = cube_tmp[53];
        cube[66] = cube_tmp[74];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[64];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[70];
        cube[73] = cube_tmp[65];
        cube[74] = cube_tmp[60];
        cube[75] = cube_tmp[55];
        cube[76] = cube_tmp[21];
        cube[81] = cube_tmp[22];
        cube[86] = cube_tmp[23];
        cube[91] = cube_tmp[24];
        cube[96] = cube_tmp[25];
        cube[126] = cube_tmp[96];
        cube[127] = cube_tmp[91];
        cube[128] = cube_tmp[86];
        cube[129] = cube_tmp[81];
        cube[130] = cube_tmp[76];
        break;

    case F_PRIME:
        cube[21] = cube_tmp[76];
        cube[22] = cube_tmp[81];
        cube[23] = cube_tmp[86];
        cube[24] = cube_tmp[91];
        cube[25] = cube_tmp[96];
        cube[30] = cube_tmp[25];
        cube[35] = cube_tmp[24];
        cube[40] = cube_tmp[23];
        cube[45] = cube_tmp[22];
        cube[50] = cube_tmp[21];
        cube[51] = cube_tmp[55];
        cube[52] = cube_tmp[60];
        cube[53] = cube_tmp[65];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[75];
        cube[56] = cube_tmp[54];
        cube[57] = cube_tmp[59];
        cube[58] = cube_tmp[64];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[74];
        cube[61] = cube_tmp[53];
        cube[62] = cube_tmp[58];
        cube[64] = cube_tmp[68];
        cube[65] = cube_tmp[73];
        cube[66] = cube_tmp[52];
        cube[67] = cube_tmp[57];
        cube[68] = cube_tmp[62];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[72];
        cube[71] = cube_tmp[51];
        cube[72] = cube_tmp[56];
        cube[73] = cube_tmp[61];
        cube[74] = cube_tmp[66];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[130];
        cube[81] = cube_tmp[129];
        cube[86] = cube_tmp[128];
        cube[91] = cube_tmp[127];
        cube[96] = cube_tmp[126];
        cube[126] = cube_tmp[30];
        cube[127] = cube_tmp[35];
        cube[128] = cube_tmp[40];
        cube[129] = cube_tmp[45];
        cube[130] = cube_tmp[50];
        break;

    case F2:
        cube[21] = cube_tmp[130];
        cube[22] = cube_tmp[129];
        cube[23] = cube_tmp[128];
        cube[24] = cube_tmp[127];
        cube[25] = cube_tmp[126];
        cube[30] = cube_tmp[96];
        cube[35] = cube_tmp[91];
        cube[40] = cube_tmp[86];
        cube[45] = cube_tmp[81];
        cube[50] = cube_tmp[76];
        cube[51] = cube_tmp[75];
        cube[52] = cube_tmp[74];
        cube[53] = cube_tmp[73];
        cube[54] = cube_tmp[72];
        cube[55] = cube_tmp[71];
        cube[56] = cube_tmp[70];
        cube[57] = cube_tmp[69];
        cube[58] = cube_tmp[68];
        cube[59] = cube_tmp[67];
        cube[60] = cube_tmp[66];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[64];
        cube[64] = cube_tmp[62];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[60];
        cube[67] = cube_tmp[59];
        cube[68] = cube_tmp[58];
        cube[69] = cube_tmp[57];
        cube[70] = cube_tmp[56];
        cube[71] = cube_tmp[55];
        cube[72] = cube_tmp[54];
        cube[73] = cube_tmp[53];
        cube[74] = cube_tmp[52];
        cube[75] = cube_tmp[51];
        cube[76] = cube_tmp[50];
        cube[81] = cube_tmp[45];
        cube[86] = cube_tmp[40];
        cube[91] = cube_tmp[35];
        cube[96] = cube_tmp[30];
        cube[126] = cube_tmp[25];
        cube[127] = cube_tmp[24];
        cube[128] = cube_tmp[23];
        cube[129] = cube_tmp[22];
        cube[130] = cube_tmp[21];
        break;

    case Fw:
        cube[16] = cube_tmp[49];
        cube[17] = cube_tmp[44];
        cube[18] = cube_tmp[39];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[50];
        cube[22] = cube_tmp[45];
        cube[23] = cube_tmp[40];
        cube[24] = cube_tmp[35];
        cube[25] = cube_tmp[30];
        cube[29] = cube_tmp[131];
        cube[30] = cube_tmp[126];
        cube[34] = cube_tmp[132];
        cube[35] = cube_tmp[127];
        cube[39] = cube_tmp[133];
        cube[40] = cube_tmp[128];
        cube[44] = cube_tmp[134];
        cube[45] = cube_tmp[129];
        cube[49] = cube_tmp[135];
        cube[50] = cube_tmp[130];
        cube[51] = cube_tmp[71];
        cube[52] = cube_tmp[66];
        cube[53] = cube_tmp[61];
        cube[54] = cube_tmp[56];
        cube[55] = cube_tmp[51];
        cube[56] = cube_tmp[72];
        cube[57] = cube_tmp[67];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[57];
        cube[60] = cube_tmp[52];
        cube[61] = cube_tmp[73];
        cube[62] = cube_tmp[68];
        cube[64] = cube_tmp[58];
        cube[65] = cube_tmp[53];
        cube[66] = cube_tmp[74];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[64];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[70];
        cube[73] = cube_tmp[65];
        cube[74] = cube_tmp[60];
        cube[75] = cube_tmp[55];
        cube[76] = cube_tmp[21];
        cube[77] = cube_tmp[16];
        cube[81] = cube_tmp[22];
        cube[82] = cube_tmp[17];
        cube[86] = cube_tmp[23];
        cube[87] = cube_tmp[18];
        cube[91] = cube_tmp[24];
        cube[92] = cube_tmp[19];
        cube[96] = cube_tmp[25];
        cube[97] = cube_tmp[20];
        cube[126] = cube_tmp[96];
        cube[127] = cube_tmp[91];
        cube[128] = cube_tmp[86];
        cube[129] = cube_tmp[81];
        cube[130] = cube_tmp[76];
        cube[131] = cube_tmp[97];
        cube[132] = cube_tmp[92];
        cube[133] = cube_tmp[87];
        cube[134] = cube_tmp[82];
        cube[135] = cube_tmp[77];
        break;

    case Fw_PRIME:
        cube[16] = cube_tmp[77];
        cube[17] = cube_tmp[82];
        cube[18] = cube_tmp[87];
        cube[19] = cube_tmp[92];
        cube[20] = cube_tmp[97];
        cube[21] = cube_tmp[76];
        cube[22] = cube_tmp[81];
        cube[23] = cube_tmp[86];
        cube[24] = cube_tmp[91];
        cube[25] = cube_tmp[96];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[25];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[24];
        cube[39] = cube_tmp[18];
        cube[40] = cube_tmp[23];
        cube[44] = cube_tmp[17];
        cube[45] = cube_tmp[22];
        cube[49] = cube_tmp[16];
        cube[50] = cube_tmp[21];
        cube[51] = cube_tmp[55];
        cube[52] = cube_tmp[60];
        cube[53] = cube_tmp[65];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[75];
        cube[56] = cube_tmp[54];
        cube[57] = cube_tmp[59];
        cube[58] = cube_tmp[64];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[74];
        cube[61] = cube_tmp[53];
        cube[62] = cube_tmp[58];
        cube[64] = cube_tmp[68];
        cube[65] = cube_tmp[73];
        cube[66] = cube_tmp[52];
        cube[67] = cube_tmp[57];
        cube[68] = cube_tmp[62];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[72];
        cube[71] = cube_tmp[51];
        cube[72] = cube_tmp[56];
        cube[73] = cube_tmp[61];
        cube[74] = cube_tmp[66];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[130];
        cube[77] = cube_tmp[135];
        cube[81] = cube_tmp[129];
        cube[82] = cube_tmp[134];
        cube[86] = cube_tmp[128];
        cube[87] = cube_tmp[133];
        cube[91] = cube_tmp[127];
        cube[92] = cube_tmp[132];
        cube[96] = cube_tmp[126];
        cube[97] = cube_tmp[131];
        cube[126] = cube_tmp[30];
        cube[127] = cube_tmp[35];
        cube[128] = cube_tmp[40];
        cube[129] = cube_tmp[45];
        cube[130] = cube_tmp[50];
        cube[131] = cube_tmp[29];
        cube[132] = cube_tmp[34];
        cube[133] = cube_tmp[39];
        cube[134] = cube_tmp[44];
        cube[135] = cube_tmp[49];
        break;

    case Fw2:
        cube[16] = cube_tmp[135];
        cube[17] = cube_tmp[134];
        cube[18] = cube_tmp[133];
        cube[19] = cube_tmp[132];
        cube[20] = cube_tmp[131];
        cube[21] = cube_tmp[130];
        cube[22] = cube_tmp[129];
        cube[23] = cube_tmp[128];
        cube[24] = cube_tmp[127];
        cube[25] = cube_tmp[126];
        cube[29] = cube_tmp[97];
        cube[30] = cube_tmp[96];
        cube[34] = cube_tmp[92];
        cube[35] = cube_tmp[91];
        cube[39] = cube_tmp[87];
        cube[40] = cube_tmp[86];
        cube[44] = cube_tmp[82];
        cube[45] = cube_tmp[81];
        cube[49] = cube_tmp[77];
        cube[50] = cube_tmp[76];
        cube[51] = cube_tmp[75];
        cube[52] = cube_tmp[74];
        cube[53] = cube_tmp[73];
        cube[54] = cube_tmp[72];
        cube[55] = cube_tmp[71];
        cube[56] = cube_tmp[70];
        cube[57] = cube_tmp[69];
        cube[58] = cube_tmp[68];
        cube[59] = cube_tmp[67];
        cube[60] = cube_tmp[66];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[64];
        cube[64] = cube_tmp[62];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[60];
        cube[67] = cube_tmp[59];
        cube[68] = cube_tmp[58];
        cube[69] = cube_tmp[57];
        cube[70] = cube_tmp[56];
        cube[71] = cube_tmp[55];
        cube[72] = cube_tmp[54];
        cube[73] = cube_tmp[53];
        cube[74] = cube_tmp[52];
        cube[75] = cube_tmp[51];
        cube[76] = cube_tmp[50];
        cube[77] = cube_tmp[49];
        cube[81] = cube_tmp[45];
        cube[82] = cube_tmp[44];
        cube[86] = cube_tmp[40];
        cube[87] = cube_tmp[39];
        cube[91] = cube_tmp[35];
        cube[92] = cube_tmp[34];
        cube[96] = cube_tmp[30];
        cube[97] = cube_tmp[29];
        cube[126] = cube_tmp[25];
        cube[127] = cube_tmp[24];
        cube[128] = cube_tmp[23];
        cube[129] = cube_tmp[22];
        cube[130] = cube_tmp[21];
        cube[131] = cube_tmp[20];
        cube[132] = cube_tmp[19];
        cube[133] = cube_tmp[18];
        cube[134] = cube_tmp[17];
        cube[135] = cube_tmp[16];
        break;

    case R:
        cube[5] = cube_tmp[55];
        cube[10] = cube_tmp[60];
        cube[15] = cube_tmp[65];
        cube[20] = cube_tmp[70];
        cube[25] = cube_tmp[75];
        cube[55] = cube_tmp[130];
        cube[60] = cube_tmp[135];
        cube[65] = cube_tmp[140];
        cube[70] = cube_tmp[145];
        cube[75] = cube_tmp[150];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[91];
        cube[78] = cube_tmp[86];
        cube[79] = cube_tmp[81];
        cube[80] = cube_tmp[76];
        cube[81] = cube_tmp[97];
        cube[82] = cube_tmp[92];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[82];
        cube[85] = cube_tmp[77];
        cube[86] = cube_tmp[98];
        cube[87] = cube_tmp[93];
        cube[89] = cube_tmp[83];
        cube[90] = cube_tmp[78];
        cube[91] = cube_tmp[99];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[89];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[79];
        cube[96] = cube_tmp[100];
        cube[97] = cube_tmp[95];
        cube[98] = cube_tmp[90];
        cube[99] = cube_tmp[85];
        cube[100] = cube_tmp[80];
        cube[101] = cube_tmp[25];
        cube[106] = cube_tmp[20];
        cube[111] = cube_tmp[15];
        cube[116] = cube_tmp[10];
        cube[121] = cube_tmp[5];
        cube[130] = cube_tmp[121];
        cube[135] = cube_tmp[116];
        cube[140] = cube_tmp[111];
        cube[145] = cube_tmp[106];
        cube[150] = cube_tmp[101];
        break;

    case R_PRIME:
        cube[5] = cube_tmp[121];
        cube[10] = cube_tmp[116];
        cube[15] = cube_tmp[111];
        cube[20] = cube_tmp[106];
        cube[25] = cube_tmp[101];
        cube[55] = cube_tmp[5];
        cube[60] = cube_tmp[10];
        cube[65] = cube_tmp[15];
        cube[70] = cube_tmp[20];
        cube[75] = cube_tmp[25];
        cube[76] = cube_tmp[80];
        cube[77] = cube_tmp[85];
        cube[78] = cube_tmp[90];
        cube[79] = cube_tmp[95];
        cube[80] = cube_tmp[100];
        cube[81] = cube_tmp[79];
        cube[82] = cube_tmp[84];
        cube[83] = cube_tmp[89];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[99];
        cube[86] = cube_tmp[78];
        cube[87] = cube_tmp[83];
        cube[89] = cube_tmp[93];
        cube[90] = cube_tmp[98];
        cube[91] = cube_tmp[77];
        cube[92] = cube_tmp[82];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[97];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[81];
        cube[98] = cube_tmp[86];
        cube[99] = cube_tmp[91];
        cube[100] = cube_tmp[96];
        cube[101] = cube_tmp[150];
        cube[106] = cube_tmp[145];
        cube[111] = cube_tmp[140];
        cube[116] = cube_tmp[135];
        cube[121] = cube_tmp[130];
        cube[130] = cube_tmp[55];
        cube[135] = cube_tmp[60];
        cube[140] = cube_tmp[65];
        cube[145] = cube_tmp[70];
        cube[150] = cube_tmp[75];
        break;

    case R2:
        cube[5] = cube_tmp[130];
        cube[10] = cube_tmp[135];
        cube[15] = cube_tmp[140];
        cube[20] = cube_tmp[145];
        cube[25] = cube_tmp[150];
        cube[55] = cube_tmp[121];
        cube[60] = cube_tmp[116];
        cube[65] = cube_tmp[111];
        cube[70] = cube_tmp[106];
        cube[75] = cube_tmp[101];
        cube[76] = cube_tmp[100];
        cube[77] = cube_tmp[99];
        cube[78] = cube_tmp[98];
        cube[79] = cube_tmp[97];
        cube[80] = cube_tmp[96];
        cube[81] = cube_tmp[95];
        cube[82] = cube_tmp[94];
        cube[83] = cube_tmp[93];
        cube[84] = cube_tmp[92];
        cube[85] = cube_tmp[91];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[89];
        cube[89] = cube_tmp[87];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[85];
        cube[92] = cube_tmp[84];
        cube[93] = cube_tmp[83];
        cube[94] = cube_tmp[82];
        cube[95] = cube_tmp[81];
        cube[96] = cube_tmp[80];
        cube[97] = cube_tmp[79];
        cube[98] = cube_tmp[78];
        cube[99] = cube_tmp[77];
        cube[100] = cube_tmp[76];
        cube[101] = cube_tmp[75];
        cube[106] = cube_tmp[70];
        cube[111] = cube_tmp[65];
        cube[116] = cube_tmp[60];
        cube[121] = cube_tmp[55];
        cube[130] = cube_tmp[5];
        cube[135] = cube_tmp[10];
        cube[140] = cube_tmp[15];
        cube[145] = cube_tmp[20];
        cube[150] = cube_tmp[25];
        break;

    case Rw:
        cube[4] = cube_tmp[54];
        cube[5] = cube_tmp[55];
        cube[9] = cube_tmp[59];
        cube[10] = cube_tmp[60];
        cube[14] = cube_tmp[64];
        cube[15] = cube_tmp[65];
        cube[19] = cube_tmp[69];
        cube[20] = cube_tmp[70];
        cube[24] = cube_tmp[74];
        cube[25] = cube_tmp[75];
        cube[54] = cube_tmp[129];
        cube[55] = cube_tmp[130];
        cube[59] = cube_tmp[134];
        cube[60] = cube_tmp[135];
        cube[64] = cube_tmp[139];
        cube[65] = cube_tmp[140];
        cube[69] = cube_tmp[144];
        cube[70] = cube_tmp[145];
        cube[74] = cube_tmp[149];
        cube[75] = cube_tmp[150];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[91];
        cube[78] = cube_tmp[86];
        cube[79] = cube_tmp[81];
        cube[80] = cube_tmp[76];
        cube[81] = cube_tmp[97];
        cube[82] = cube_tmp[92];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[82];
        cube[85] = cube_tmp[77];
        cube[86] = cube_tmp[98];
        cube[87] = cube_tmp[93];
        cube[89] = cube_tmp[83];
        cube[90] = cube_tmp[78];
        cube[91] = cube_tmp[99];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[89];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[79];
        cube[96] = cube_tmp[100];
        cube[97] = cube_tmp[95];
        cube[98] = cube_tmp[90];
        cube[99] = cube_tmp[85];
        cube[100] = cube_tmp[80];
        cube[101] = cube_tmp[25];
        cube[102] = cube_tmp[24];
        cube[106] = cube_tmp[20];
        cube[107] = cube_tmp[19];
        cube[111] = cube_tmp[15];
        cube[112] = cube_tmp[14];
        cube[116] = cube_tmp[10];
        cube[117] = cube_tmp[9];
        cube[121] = cube_tmp[5];
        cube[122] = cube_tmp[4];
        cube[129] = cube_tmp[122];
        cube[130] = cube_tmp[121];
        cube[134] = cube_tmp[117];
        cube[135] = cube_tmp[116];
        cube[139] = cube_tmp[112];
        cube[140] = cube_tmp[111];
        cube[144] = cube_tmp[107];
        cube[145] = cube_tmp[106];
        cube[149] = cube_tmp[102];
        cube[150] = cube_tmp[101];
        break;

    case Rw_PRIME:
        cube[4] = cube_tmp[122];
        cube[5] = cube_tmp[121];
        cube[9] = cube_tmp[117];
        cube[10] = cube_tmp[116];
        cube[14] = cube_tmp[112];
        cube[15] = cube_tmp[111];
        cube[19] = cube_tmp[107];
        cube[20] = cube_tmp[106];
        cube[24] = cube_tmp[102];
        cube[25] = cube_tmp[101];
        cube[54] = cube_tmp[4];
        cube[55] = cube_tmp[5];
        cube[59] = cube_tmp[9];
        cube[60] = cube_tmp[10];
        cube[64] = cube_tmp[14];
        cube[65] = cube_tmp[15];
        cube[69] = cube_tmp[19];
        cube[70] = cube_tmp[20];
        cube[74] = cube_tmp[24];
        cube[75] = cube_tmp[25];
        cube[76] = cube_tmp[80];
        cube[77] = cube_tmp[85];
        cube[78] = cube_tmp[90];
        cube[79] = cube_tmp[95];
        cube[80] = cube_tmp[100];
        cube[81] = cube_tmp[79];
        cube[82] = cube_tmp[84];
        cube[83] = cube_tmp[89];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[99];
        cube[86] = cube_tmp[78];
        cube[87] = cube_tmp[83];
        cube[89] = cube_tmp[93];
        cube[90] = cube_tmp[98];
        cube[91] = cube_tmp[77];
        cube[92] = cube_tmp[82];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[97];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[81];
        cube[98] = cube_tmp[86];
        cube[99] = cube_tmp[91];
        cube[100] = cube_tmp[96];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[149];
        cube[106] = cube_tmp[145];
        cube[107] = cube_tmp[144];
        cube[111] = cube_tmp[140];
        cube[112] = cube_tmp[139];
        cube[116] = cube_tmp[135];
        cube[117] = cube_tmp[134];
        cube[121] = cube_tmp[130];
        cube[122] = cube_tmp[129];
        cube[129] = cube_tmp[54];
        cube[130] = cube_tmp[55];
        cube[134] = cube_tmp[59];
        cube[135] = cube_tmp[60];
        cube[139] = cube_tmp[64];
        cube[140] = cube_tmp[65];
        cube[144] = cube_tmp[69];
        cube[145] = cube_tmp[70];
        cube[149] = cube_tmp[74];
        cube[150] = cube_tmp[75];
        break;

    case Rw2:
        cube[4] = cube_tmp[129];
        cube[5] = cube_tmp[130];
        cube[9] = cube_tmp[134];
        cube[10] = cube_tmp[135];
        cube[14] = cube_tmp[139];
        cube[15] = cube_tmp[140];
        cube[19] = cube_tmp[144];
        cube[20] = cube_tmp[145];
        cube[24] = cube_tmp[149];
        cube[25] = cube_tmp[150];
        cube[54] = cube_tmp[122];
        cube[55] = cube_tmp[121];
        cube[59] = cube_tmp[117];
        cube[60] = cube_tmp[116];
        cube[64] = cube_tmp[112];
        cube[65] = cube_tmp[111];
        cube[69] = cube_tmp[107];
        cube[70] = cube_tmp[106];
        cube[74] = cube_tmp[102];
        cube[75] = cube_tmp[101];
        cube[76] = cube_tmp[100];
        cube[77] = cube_tmp[99];
        cube[78] = cube_tmp[98];
        cube[79] = cube_tmp[97];
        cube[80] = cube_tmp[96];
        cube[81] = cube_tmp[95];
        cube[82] = cube_tmp[94];
        cube[83] = cube_tmp[93];
        cube[84] = cube_tmp[92];
        cube[85] = cube_tmp[91];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[89];
        cube[89] = cube_tmp[87];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[85];
        cube[92] = cube_tmp[84];
        cube[93] = cube_tmp[83];
        cube[94] = cube_tmp[82];
        cube[95] = cube_tmp[81];
        cube[96] = cube_tmp[80];
        cube[97] = cube_tmp[79];
        cube[98] = cube_tmp[78];
        cube[99] = cube_tmp[77];
        cube[100] = cube_tmp[76];
        cube[101] = cube_tmp[75];
        cube[102] = cube_tmp[74];
        cube[106] = cube_tmp[70];
        cube[107] = cube_tmp[69];
        cube[111] = cube_tmp[65];
        cube[112] = cube_tmp[64];
        cube[116] = cube_tmp[60];
        cube[117] = cube_tmp[59];
        cube[121] = cube_tmp[55];
        cube[122] = cube_tmp[54];
        cube[129] = cube_tmp[4];
        cube[130] = cube_tmp[5];
        cube[134] = cube_tmp[9];
        cube[135] = cube_tmp[10];
        cube[139] = cube_tmp[14];
        cube[140] = cube_tmp[15];
        cube[144] = cube_tmp[19];
        cube[145] = cube_tmp[20];
        cube[149] = cube_tmp[24];
        cube[150] = cube_tmp[25];
        break;

    case B:
        cube[1] = cube_tmp[80];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[90];
        cube[4] = cube_tmp[95];
        cube[5] = cube_tmp[100];
        cube[26] = cube_tmp[5];
        cube[31] = cube_tmp[4];
        cube[36] = cube_tmp[3];
        cube[41] = cube_tmp[2];
        cube[46] = cube_tmp[1];
        cube[80] = cube_tmp[150];
        cube[85] = cube_tmp[149];
        cube[90] = cube_tmp[148];
        cube[95] = cube_tmp[147];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[121];
        cube[102] = cube_tmp[116];
        cube[103] = cube_tmp[111];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[101];
        cube[106] = cube_tmp[122];
        cube[107] = cube_tmp[117];
        cube[108] = cube_tmp[112];
        cube[109] = cube_tmp[107];
        cube[110] = cube_tmp[102];
        cube[111] = cube_tmp[123];
        cube[112] = cube_tmp[118];
        cube[114] = cube_tmp[108];
        cube[115] = cube_tmp[103];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[119];
        cube[118] = cube_tmp[114];
        cube[119] = cube_tmp[109];
        cube[120] = cube_tmp[104];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[120];
        cube[123] = cube_tmp[115];
        cube[124] = cube_tmp[110];
        cube[125] = cube_tmp[105];
        cube[146] = cube_tmp[26];
        cube[147] = cube_tmp[31];
        cube[148] = cube_tmp[36];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[46];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[46];
        cube[2] = cube_tmp[41];
        cube[3] = cube_tmp[36];
        cube[4] = cube_tmp[31];
        cube[5] = cube_tmp[26];
        cube[26] = cube_tmp[146];
        cube[31] = cube_tmp[147];
        cube[36] = cube_tmp[148];
        cube[41] = cube_tmp[149];
        cube[46] = cube_tmp[150];
        cube[80] = cube_tmp[1];
        cube[85] = cube_tmp[2];
        cube[90] = cube_tmp[3];
        cube[95] = cube_tmp[4];
        cube[100] = cube_tmp[5];
        cube[101] = cube_tmp[105];
        cube[102] = cube_tmp[110];
        cube[103] = cube_tmp[115];
        cube[104] = cube_tmp[120];
        cube[105] = cube_tmp[125];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[109];
        cube[108] = cube_tmp[114];
        cube[109] = cube_tmp[119];
        cube[110] = cube_tmp[124];
        cube[111] = cube_tmp[103];
        cube[112] = cube_tmp[108];
        cube[114] = cube_tmp[118];
        cube[115] = cube_tmp[123];
        cube[116] = cube_tmp[102];
        cube[117] = cube_tmp[107];
        cube[118] = cube_tmp[112];
        cube[119] = cube_tmp[117];
        cube[120] = cube_tmp[122];
        cube[121] = cube_tmp[101];
        cube[122] = cube_tmp[106];
        cube[123] = cube_tmp[111];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[121];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[95];
        cube[148] = cube_tmp[90];
        cube[149] = cube_tmp[85];
        cube[150] = cube_tmp[80];
        break;

    case B2:
        cube[1] = cube_tmp[150];
        cube[2] = cube_tmp[149];
        cube[3] = cube_tmp[148];
        cube[4] = cube_tmp[147];
        cube[5] = cube_tmp[146];
        cube[26] = cube_tmp[100];
        cube[31] = cube_tmp[95];
        cube[36] = cube_tmp[90];
        cube[41] = cube_tmp[85];
        cube[46] = cube_tmp[80];
        cube[80] = cube_tmp[46];
        cube[85] = cube_tmp[41];
        cube[90] = cube_tmp[36];
        cube[95] = cube_tmp[31];
        cube[100] = cube_tmp[26];
        cube[101] = cube_tmp[125];
        cube[102] = cube_tmp[124];
        cube[103] = cube_tmp[123];
        cube[104] = cube_tmp[122];
        cube[105] = cube_tmp[121];
        cube[106] = cube_tmp[120];
        cube[107] = cube_tmp[119];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[117];
        cube[110] = cube_tmp[116];
        cube[111] = cube_tmp[115];
        cube[112] = cube_tmp[114];
        cube[114] = cube_tmp[112];
        cube[115] = cube_tmp[111];
        cube[116] = cube_tmp[110];
        cube[117] = cube_tmp[109];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[107];
        cube[120] = cube_tmp[106];
        cube[121] = cube_tmp[105];
        cube[122] = cube_tmp[104];
        cube[123] = cube_tmp[103];
        cube[124] = cube_tmp[102];
        cube[125] = cube_tmp[101];
        cube[146] = cube_tmp[5];
        cube[147] = cube_tmp[4];
        cube[148] = cube_tmp[3];
        cube[149] = cube_tmp[2];
        cube[150] = cube_tmp[1];
        break;

    case Bw:
        cube[1] = cube_tmp[80];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[90];
        cube[4] = cube_tmp[95];
        cube[5] = cube_tmp[100];
        cube[6] = cube_tmp[79];
        cube[7] = cube_tmp[84];
        cube[8] = cube_tmp[89];
        cube[9] = cube_tmp[94];
        cube[10] = cube_tmp[99];
        cube[26] = cube_tmp[5];
        cube[27] = cube_tmp[10];
        cube[31] = cube_tmp[4];
        cube[32] = cube_tmp[9];
        cube[36] = cube_tmp[3];
        cube[37] = cube_tmp[8];
        cube[41] = cube_tmp[2];
        cube[42] = cube_tmp[7];
        cube[46] = cube_tmp[1];
        cube[47] = cube_tmp[6];
        cube[79] = cube_tmp[145];
        cube[80] = cube_tmp[150];
        cube[84] = cube_tmp[144];
        cube[85] = cube_tmp[149];
        cube[89] = cube_tmp[143];
        cube[90] = cube_tmp[148];
        cube[94] = cube_tmp[142];
        cube[95] = cube_tmp[147];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[121];
        cube[102] = cube_tmp[116];
        cube[103] = cube_tmp[111];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[101];
        cube[106] = cube_tmp[122];
        cube[107] = cube_tmp[117];
        cube[108] = cube_tmp[112];
        cube[109] = cube_tmp[107];
        cube[110] = cube_tmp[102];
        cube[111] = cube_tmp[123];
        cube[112] = cube_tmp[118];
        cube[114] = cube_tmp[108];
        cube[115] = cube_tmp[103];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[119];
        cube[118] = cube_tmp[114];
        cube[119] = cube_tmp[109];
        cube[120] = cube_tmp[104];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[120];
        cube[123] = cube_tmp[115];
        cube[124] = cube_tmp[110];
        cube[125] = cube_tmp[105];
        cube[141] = cube_tmp[27];
        cube[142] = cube_tmp[32];
        cube[143] = cube_tmp[37];
        cube[144] = cube_tmp[42];
        cube[145] = cube_tmp[47];
        cube[146] = cube_tmp[26];
        cube[147] = cube_tmp[31];
        cube[148] = cube_tmp[36];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[46];
        break;

    case Bw_PRIME:
        cube[1] = cube_tmp[46];
        cube[2] = cube_tmp[41];
        cube[3] = cube_tmp[36];
        cube[4] = cube_tmp[31];
        cube[5] = cube_tmp[26];
        cube[6] = cube_tmp[47];
        cube[7] = cube_tmp[42];
        cube[8] = cube_tmp[37];
        cube[9] = cube_tmp[32];
        cube[10] = cube_tmp[27];
        cube[26] = cube_tmp[146];
        cube[27] = cube_tmp[141];
        cube[31] = cube_tmp[147];
        cube[32] = cube_tmp[142];
        cube[36] = cube_tmp[148];
        cube[37] = cube_tmp[143];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[144];
        cube[46] = cube_tmp[150];
        cube[47] = cube_tmp[145];
        cube[79] = cube_tmp[6];
        cube[80] = cube_tmp[1];
        cube[84] = cube_tmp[7];
        cube[85] = cube_tmp[2];
        cube[89] = cube_tmp[8];
        cube[90] = cube_tmp[3];
        cube[94] = cube_tmp[9];
        cube[95] = cube_tmp[4];
        cube[99] = cube_tmp[10];
        cube[100] = cube_tmp[5];
        cube[101] = cube_tmp[105];
        cube[102] = cube_tmp[110];
        cube[103] = cube_tmp[115];
        cube[104] = cube_tmp[120];
        cube[105] = cube_tmp[125];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[109];
        cube[108] = cube_tmp[114];
        cube[109] = cube_tmp[119];
        cube[110] = cube_tmp[124];
        cube[111] = cube_tmp[103];
        cube[112] = cube_tmp[108];
        cube[114] = cube_tmp[118];
        cube[115] = cube_tmp[123];
        cube[116] = cube_tmp[102];
        cube[117] = cube_tmp[107];
        cube[118] = cube_tmp[112];
        cube[119] = cube_tmp[117];
        cube[120] = cube_tmp[122];
        cube[121] = cube_tmp[101];
        cube[122] = cube_tmp[106];
        cube[123] = cube_tmp[111];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[121];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[94];
        cube[143] = cube_tmp[89];
        cube[144] = cube_tmp[84];
        cube[145] = cube_tmp[79];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[95];
        cube[148] = cube_tmp[90];
        cube[149] = cube_tmp[85];
        cube[150] = cube_tmp[80];
        break;

    case Bw2:
        cube[1] = cube_tmp[150];
        cube[2] = cube_tmp[149];
        cube[3] = cube_tmp[148];
        cube[4] = cube_tmp[147];
        cube[5] = cube_tmp[146];
        cube[6] = cube_tmp[145];
        cube[7] = cube_tmp[144];
        cube[8] = cube_tmp[143];
        cube[9] = cube_tmp[142];
        cube[10] = cube_tmp[141];
        cube[26] = cube_tmp[100];
        cube[27] = cube_tmp[99];
        cube[31] = cube_tmp[95];
        cube[32] = cube_tmp[94];
        cube[36] = cube_tmp[90];
        cube[37] = cube_tmp[89];
        cube[41] = cube_tmp[85];
        cube[42] = cube_tmp[84];
        cube[46] = cube_tmp[80];
        cube[47] = cube_tmp[79];
        cube[79] = cube_tmp[47];
        cube[80] = cube_tmp[46];
        cube[84] = cube_tmp[42];
        cube[85] = cube_tmp[41];
        cube[89] = cube_tmp[37];
        cube[90] = cube_tmp[36];
        cube[94] = cube_tmp[32];
        cube[95] = cube_tmp[31];
        cube[99] = cube_tmp[27];
        cube[100] = cube_tmp[26];
        cube[101] = cube_tmp[125];
        cube[102] = cube_tmp[124];
        cube[103] = cube_tmp[123];
        cube[104] = cube_tmp[122];
        cube[105] = cube_tmp[121];
        cube[106] = cube_tmp[120];
        cube[107] = cube_tmp[119];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[117];
        cube[110] = cube_tmp[116];
        cube[111] = cube_tmp[115];
        cube[112] = cube_tmp[114];
        cube[114] = cube_tmp[112];
        cube[115] = cube_tmp[111];
        cube[116] = cube_tmp[110];
        cube[117] = cube_tmp[109];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[107];
        cube[120] = cube_tmp[106];
        cube[121] = cube_tmp[105];
        cube[122] = cube_tmp[104];
        cube[123] = cube_tmp[103];
        cube[124] = cube_tmp[102];
        cube[125] = cube_tmp[101];
        cube[141] = cube_tmp[10];
        cube[142] = cube_tmp[9];
        cube[143] = cube_tmp[8];
        cube[144] = cube_tmp[7];
        cube[145] = cube_tmp[6];
        cube[146] = cube_tmp[5];
        cube[147] = cube_tmp[4];
        cube[148] = cube_tmp[3];
        cube[149] = cube_tmp[2];
        cube[150] = cube_tmp[1];
        break;

    case D:
        cube[46] = cube_tmp[121];
        cube[47] = cube_tmp[122];
        cube[48] = cube_tmp[123];
        cube[49] = cube_tmp[124];
        cube[50] = cube_tmp[125];
        cube[71] = cube_tmp[46];
        cube[72] = cube_tmp[47];
        cube[73] = cube_tmp[48];
        cube[74] = cube_tmp[49];
        cube[75] = cube_tmp[50];
        cube[96] = cube_tmp[71];
        cube[97] = cube_tmp[72];
        cube[98] = cube_tmp[73];
        cube[99] = cube_tmp[74];
        cube[100] = cube_tmp[75];
        cube[121] = cube_tmp[96];
        cube[122] = cube_tmp[97];
        cube[123] = cube_tmp[98];
        cube[124] = cube_tmp[99];
        cube[125] = cube_tmp[100];
        cube[126] = cube_tmp[146];
        cube[127] = cube_tmp[141];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[126];
        cube[131] = cube_tmp[147];
        cube[132] = cube_tmp[142];
        cube[133] = cube_tmp[137];
        cube[134] = cube_tmp[132];
        cube[135] = cube_tmp[127];
        cube[136] = cube_tmp[148];
        cube[137] = cube_tmp[143];
        cube[139] = cube_tmp[133];
        cube[140] = cube_tmp[128];
        cube[141] = cube_tmp[149];
        cube[142] = cube_tmp[144];
        cube[143] = cube_tmp[139];
        cube[144] = cube_tmp[134];
        cube[145] = cube_tmp[129];
        cube[146] = cube_tmp[150];
        cube[147] = cube_tmp[145];
        cube[148] = cube_tmp[140];
        cube[149] = cube_tmp[135];
        cube[150] = cube_tmp[130];
        break;

    case D_PRIME:
        cube[46] = cube_tmp[71];
        cube[47] = cube_tmp[72];
        cube[48] = cube_tmp[73];
        cube[49] = cube_tmp[74];
        cube[50] = cube_tmp[75];
        cube[71] = cube_tmp[96];
        cube[72] = cube_tmp[97];
        cube[73] = cube_tmp[98];
        cube[74] = cube_tmp[99];
        cube[75] = cube_tmp[100];
        cube[96] = cube_tmp[121];
        cube[97] = cube_tmp[122];
        cube[98] = cube_tmp[123];
        cube[99] = cube_tmp[124];
        cube[100] = cube_tmp[125];
        cube[121] = cube_tmp[46];
        cube[122] = cube_tmp[47];
        cube[123] = cube_tmp[48];
        cube[124] = cube_tmp[49];
        cube[125] = cube_tmp[50];
        cube[126] = cube_tmp[130];
        cube[127] = cube_tmp[135];
        cube[128] = cube_tmp[140];
        cube[129] = cube_tmp[145];
        cube[130] = cube_tmp[150];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[134];
        cube[133] = cube_tmp[139];
        cube[134] = cube_tmp[144];
        cube[135] = cube_tmp[149];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[133];
        cube[139] = cube_tmp[143];
        cube[140] = cube_tmp[148];
        cube[141] = cube_tmp[127];
        cube[142] = cube_tmp[132];
        cube[143] = cube_tmp[137];
        cube[144] = cube_tmp[142];
        cube[145] = cube_tmp[147];
        cube[146] = cube_tmp[126];
        cube[147] = cube_tmp[131];
        cube[148] = cube_tmp[136];
        cube[149] = cube_tmp[141];
        cube[150] = cube_tmp[146];
        break;

    case D2:
        cube[46] = cube_tmp[96];
        cube[47] = cube_tmp[97];
        cube[48] = cube_tmp[98];
        cube[49] = cube_tmp[99];
        cube[50] = cube_tmp[100];
        cube[71] = cube_tmp[121];
        cube[72] = cube_tmp[122];
        cube[73] = cube_tmp[123];
        cube[74] = cube_tmp[124];
        cube[75] = cube_tmp[125];
        cube[96] = cube_tmp[46];
        cube[97] = cube_tmp[47];
        cube[98] = cube_tmp[48];
        cube[99] = cube_tmp[49];
        cube[100] = cube_tmp[50];
        cube[121] = cube_tmp[71];
        cube[122] = cube_tmp[72];
        cube[123] = cube_tmp[73];
        cube[124] = cube_tmp[74];
        cube[125] = cube_tmp[75];
        cube[126] = cube_tmp[150];
        cube[127] = cube_tmp[149];
        cube[128] = cube_tmp[148];
        cube[129] = cube_tmp[147];
        cube[130] = cube_tmp[146];
        cube[131] = cube_tmp[145];
        cube[132] = cube_tmp[144];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[142];
        cube[135] = cube_tmp[141];
        cube[136] = cube_tmp[140];
        cube[137] = cube_tmp[139];
        cube[139] = cube_tmp[137];
        cube[140] = cube_tmp[136];
        cube[141] = cube_tmp[135];
        cube[142] = cube_tmp[134];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[132];
        cube[145] = cube_tmp[131];
        cube[146] = cube_tmp[130];
        cube[147] = cube_tmp[129];
        cube[148] = cube_tmp[128];
        cube[149] = cube_tmp[127];
        cube[150] = cube_tmp[126];
        break;

    case Dw:
        cube[41] = cube_tmp[116];
        cube[42] = cube_tmp[117];
        cube[43] = cube_tmp[118];
        cube[44] = cube_tmp[119];
        cube[45] = cube_tmp[120];
        cube[46] = cube_tmp[121];
        cube[47] = cube_tmp[122];
        cube[48] = cube_tmp[123];
        cube[49] = cube_tmp[124];
        cube[50] = cube_tmp[125];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[42];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[44];
        cube[70] = cube_tmp[45];
        cube[71] = cube_tmp[46];
        cube[72] = cube_tmp[47];
        cube[73] = cube_tmp[48];
        cube[74] = cube_tmp[49];
        cube[75] = cube_tmp[50];
        cube[91] = cube_tmp[66];
        cube[92] = cube_tmp[67];
        cube[93] = cube_tmp[68];
        cube[94] = cube_tmp[69];
        cube[95] = cube_tmp[70];
        cube[96] = cube_tmp[71];
        cube[97] = cube_tmp[72];
        cube[98] = cube_tmp[73];
        cube[99] = cube_tmp[74];
        cube[100] = cube_tmp[75];
        cube[116] = cube_tmp[91];
        cube[117] = cube_tmp[92];
        cube[118] = cube_tmp[93];
        cube[119] = cube_tmp[94];
        cube[120] = cube_tmp[95];
        cube[121] = cube_tmp[96];
        cube[122] = cube_tmp[97];
        cube[123] = cube_tmp[98];
        cube[124] = cube_tmp[99];
        cube[125] = cube_tmp[100];
        cube[126] = cube_tmp[146];
        cube[127] = cube_tmp[141];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[126];
        cube[131] = cube_tmp[147];
        cube[132] = cube_tmp[142];
        cube[133] = cube_tmp[137];
        cube[134] = cube_tmp[132];
        cube[135] = cube_tmp[127];
        cube[136] = cube_tmp[148];
        cube[137] = cube_tmp[143];
        cube[139] = cube_tmp[133];
        cube[140] = cube_tmp[128];
        cube[141] = cube_tmp[149];
        cube[142] = cube_tmp[144];
        cube[143] = cube_tmp[139];
        cube[144] = cube_tmp[134];
        cube[145] = cube_tmp[129];
        cube[146] = cube_tmp[150];
        cube[147] = cube_tmp[145];
        cube[148] = cube_tmp[140];
        cube[149] = cube_tmp[135];
        cube[150] = cube_tmp[130];
        break;

    case Dw_PRIME:
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[67];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[69];
        cube[45] = cube_tmp[70];
        cube[46] = cube_tmp[71];
        cube[47] = cube_tmp[72];
        cube[48] = cube_tmp[73];
        cube[49] = cube_tmp[74];
        cube[50] = cube_tmp[75];
        cube[66] = cube_tmp[91];
        cube[67] = cube_tmp[92];
        cube[68] = cube_tmp[93];
        cube[69] = cube_tmp[94];
        cube[70] = cube_tmp[95];
        cube[71] = cube_tmp[96];
        cube[72] = cube_tmp[97];
        cube[73] = cube_tmp[98];
        cube[74] = cube_tmp[99];
        cube[75] = cube_tmp[100];
        cube[91] = cube_tmp[116];
        cube[92] = cube_tmp[117];
        cube[93] = cube_tmp[118];
        cube[94] = cube_tmp[119];
        cube[95] = cube_tmp[120];
        cube[96] = cube_tmp[121];
        cube[97] = cube_tmp[122];
        cube[98] = cube_tmp[123];
        cube[99] = cube_tmp[124];
        cube[100] = cube_tmp[125];
        cube[116] = cube_tmp[41];
        cube[117] = cube_tmp[42];
        cube[118] = cube_tmp[43];
        cube[119] = cube_tmp[44];
        cube[120] = cube_tmp[45];
        cube[121] = cube_tmp[46];
        cube[122] = cube_tmp[47];
        cube[123] = cube_tmp[48];
        cube[124] = cube_tmp[49];
        cube[125] = cube_tmp[50];
        cube[126] = cube_tmp[130];
        cube[127] = cube_tmp[135];
        cube[128] = cube_tmp[140];
        cube[129] = cube_tmp[145];
        cube[130] = cube_tmp[150];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[134];
        cube[133] = cube_tmp[139];
        cube[134] = cube_tmp[144];
        cube[135] = cube_tmp[149];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[133];
        cube[139] = cube_tmp[143];
        cube[140] = cube_tmp[148];
        cube[141] = cube_tmp[127];
        cube[142] = cube_tmp[132];
        cube[143] = cube_tmp[137];
        cube[144] = cube_tmp[142];
        cube[145] = cube_tmp[147];
        cube[146] = cube_tmp[126];
        cube[147] = cube_tmp[131];
        cube[148] = cube_tmp[136];
        cube[149] = cube_tmp[141];
        cube[150] = cube_tmp[146];
        break;

    case Dw2:
        cube[41] = cube_tmp[91];
        cube[42] = cube_tmp[92];
        cube[43] = cube_tmp[93];
        cube[44] = cube_tmp[94];
        cube[45] = cube_tmp[95];
        cube[46] = cube_tmp[96];
        cube[47] = cube_tmp[97];
        cube[48] = cube_tmp[98];
        cube[49] = cube_tmp[99];
        cube[50] = cube_tmp[100];
        cube[66] = cube_tmp[116];
        cube[67] = cube_tmp[117];
        cube[68] = cube_tmp[118];
        cube[69] = cube_tmp[119];
        cube[70] = cube_tmp[120];
        cube[71] = cube_tmp[121];
        cube[72] = cube_tmp[122];
        cube[73] = cube_tmp[123];
        cube[74] = cube_tmp[124];
        cube[75] = cube_tmp[125];
        cube[91] = cube_tmp[41];
        cube[92] = cube_tmp[42];
        cube[93] = cube_tmp[43];
        cube[94] = cube_tmp[44];
        cube[95] = cube_tmp[45];
        cube[96] = cube_tmp[46];
        cube[97] = cube_tmp[47];
        cube[98] = cube_tmp[48];
        cube[99] = cube_tmp[49];
        cube[100] = cube_tmp[50];
        cube[116] = cube_tmp[66];
        cube[117] = cube_tmp[67];
        cube[118] = cube_tmp[68];
        cube[119] = cube_tmp[69];
        cube[120] = cube_tmp[70];
        cube[121] = cube_tmp[71];
        cube[122] = cube_tmp[72];
        cube[123] = cube_tmp[73];
        cube[124] = cube_tmp[74];
        cube[125] = cube_tmp[75];
        cube[126] = cube_tmp[150];
        cube[127] = cube_tmp[149];
        cube[128] = cube_tmp[148];
        cube[129] = cube_tmp[147];
        cube[130] = cube_tmp[146];
        cube[131] = cube_tmp[145];
        cube[132] = cube_tmp[144];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[142];
        cube[135] = cube_tmp[141];
        cube[136] = cube_tmp[140];
        cube[137] = cube_tmp[139];
        cube[139] = cube_tmp[137];
        cube[140] = cube_tmp[136];
        cube[141] = cube_tmp[135];
        cube[142] = cube_tmp[134];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[132];
        cube[145] = cube_tmp[131];
        cube[146] = cube_tmp[130];
        cube[147] = cube_tmp[129];
        cube[148] = cube_tmp[128];
        cube[149] = cube_tmp[127];
        cube[150] = cube_tmp[126];
        break;

    case X:
        cube[1] = cube_tmp[51];
        cube[2] = cube_tmp[52];
        cube[3] = cube_tmp[53];
        cube[4] = cube_tmp[54];
        cube[5] = cube_tmp[55];
        cube[6] = cube_tmp[56];
        cube[7] = cube_tmp[57];
        cube[8] = cube_tmp[58];
        cube[9] = cube_tmp[59];
        cube[10] = cube_tmp[60];
        cube[11] = cube_tmp[61];
        cube[12] = cube_tmp[62];
        cube[13] = cube_tmp[63];
        cube[14] = cube_tmp[64];
        cube[15] = cube_tmp[65];
        cube[16] = cube_tmp[66];
        cube[17] = cube_tmp[67];
        cube[18] = cube_tmp[68];
        cube[19] = cube_tmp[69];
        cube[20] = cube_tmp[70];
        cube[21] = cube_tmp[71];
        cube[22] = cube_tmp[72];
        cube[23] = cube_tmp[73];
        cube[24] = cube_tmp[74];
        cube[25] = cube_tmp[75];
        cube[26] = cube_tmp[30];
        cube[27] = cube_tmp[35];
        cube[28] = cube_tmp[40];
        cube[29] = cube_tmp[45];
        cube[30] = cube_tmp[50];
        cube[31] = cube_tmp[29];
        cube[32] = cube_tmp[34];
        cube[33] = cube_tmp[39];
        cube[34] = cube_tmp[44];
        cube[35] = cube_tmp[49];
        cube[36] = cube_tmp[28];
        cube[37] = cube_tmp[33];
        cube[39] = cube_tmp[43];
        cube[40] = cube_tmp[48];
        cube[41] = cube_tmp[27];
        cube[42] = cube_tmp[32];
        cube[43] = cube_tmp[37];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[47];
        cube[46] = cube_tmp[26];
        cube[47] = cube_tmp[31];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[41];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[126];
        cube[52] = cube_tmp[127];
        cube[53] = cube_tmp[128];
        cube[54] = cube_tmp[129];
        cube[55] = cube_tmp[130];
        cube[56] = cube_tmp[131];
        cube[57] = cube_tmp[132];
        cube[58] = cube_tmp[133];
        cube[59] = cube_tmp[134];
        cube[60] = cube_tmp[135];
        cube[61] = cube_tmp[136];
        cube[62] = cube_tmp[137];
        cube[63] = cube_tmp[138];
        cube[64] = cube_tmp[139];
        cube[65] = cube_tmp[140];
        cube[66] = cube_tmp[141];
        cube[67] = cube_tmp[142];
        cube[68] = cube_tmp[143];
        cube[69] = cube_tmp[144];
        cube[70] = cube_tmp[145];
        cube[71] = cube_tmp[146];
        cube[72] = cube_tmp[147];
        cube[73] = cube_tmp[148];
        cube[74] = cube_tmp[149];
        cube[75] = cube_tmp[150];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[91];
        cube[78] = cube_tmp[86];
        cube[79] = cube_tmp[81];
        cube[80] = cube_tmp[76];
        cube[81] = cube_tmp[97];
        cube[82] = cube_tmp[92];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[82];
        cube[85] = cube_tmp[77];
        cube[86] = cube_tmp[98];
        cube[87] = cube_tmp[93];
        cube[89] = cube_tmp[83];
        cube[90] = cube_tmp[78];
        cube[91] = cube_tmp[99];
        cube[92] = cube_tmp[94];
        cube[93] = cube_tmp[89];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[79];
        cube[96] = cube_tmp[100];
        cube[97] = cube_tmp[95];
        cube[98] = cube_tmp[90];
        cube[99] = cube_tmp[85];
        cube[100] = cube_tmp[80];
        cube[101] = cube_tmp[25];
        cube[102] = cube_tmp[24];
        cube[103] = cube_tmp[23];
        cube[104] = cube_tmp[22];
        cube[105] = cube_tmp[21];
        cube[106] = cube_tmp[20];
        cube[107] = cube_tmp[19];
        cube[108] = cube_tmp[18];
        cube[109] = cube_tmp[17];
        cube[110] = cube_tmp[16];
        cube[111] = cube_tmp[15];
        cube[112] = cube_tmp[14];
        cube[113] = cube_tmp[13];
        cube[114] = cube_tmp[12];
        cube[115] = cube_tmp[11];
        cube[116] = cube_tmp[10];
        cube[117] = cube_tmp[9];
        cube[118] = cube_tmp[8];
        cube[119] = cube_tmp[7];
        cube[120] = cube_tmp[6];
        cube[121] = cube_tmp[5];
        cube[122] = cube_tmp[4];
        cube[123] = cube_tmp[3];
        cube[124] = cube_tmp[2];
        cube[125] = cube_tmp[1];
        cube[126] = cube_tmp[125];
        cube[127] = cube_tmp[124];
        cube[128] = cube_tmp[123];
        cube[129] = cube_tmp[122];
        cube[130] = cube_tmp[121];
        cube[131] = cube_tmp[120];
        cube[132] = cube_tmp[119];
        cube[133] = cube_tmp[118];
        cube[134] = cube_tmp[117];
        cube[135] = cube_tmp[116];
        cube[136] = cube_tmp[115];
        cube[137] = cube_tmp[114];
        cube[138] = cube_tmp[113];
        cube[139] = cube_tmp[112];
        cube[140] = cube_tmp[111];
        cube[141] = cube_tmp[110];
        cube[142] = cube_tmp[109];
        cube[143] = cube_tmp[108];
        cube[144] = cube_tmp[107];
        cube[145] = cube_tmp[106];
        cube[146] = cube_tmp[105];
        cube[147] = cube_tmp[104];
        cube[148] = cube_tmp[103];
        cube[149] = cube_tmp[102];
        cube[150] = cube_tmp[101];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[125];
        cube[2] = cube_tmp[124];
        cube[3] = cube_tmp[123];
        cube[4] = cube_tmp[122];
        cube[5] = cube_tmp[121];
        cube[6] = cube_tmp[120];
        cube[7] = cube_tmp[119];
        cube[8] = cube_tmp[118];
        cube[9] = cube_tmp[117];
        cube[10] = cube_tmp[116];
        cube[11] = cube_tmp[115];
        cube[12] = cube_tmp[114];
        cube[13] = cube_tmp[113];
        cube[14] = cube_tmp[112];
        cube[15] = cube_tmp[111];
        cube[16] = cube_tmp[110];
        cube[17] = cube_tmp[109];
        cube[18] = cube_tmp[108];
        cube[19] = cube_tmp[107];
        cube[20] = cube_tmp[106];
        cube[21] = cube_tmp[105];
        cube[22] = cube_tmp[104];
        cube[23] = cube_tmp[103];
        cube[24] = cube_tmp[102];
        cube[25] = cube_tmp[101];
        cube[26] = cube_tmp[46];
        cube[27] = cube_tmp[41];
        cube[28] = cube_tmp[36];
        cube[29] = cube_tmp[31];
        cube[30] = cube_tmp[26];
        cube[31] = cube_tmp[47];
        cube[32] = cube_tmp[42];
        cube[33] = cube_tmp[37];
        cube[34] = cube_tmp[32];
        cube[35] = cube_tmp[27];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[43];
        cube[39] = cube_tmp[33];
        cube[40] = cube_tmp[28];
        cube[41] = cube_tmp[49];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[39];
        cube[44] = cube_tmp[34];
        cube[45] = cube_tmp[29];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[45];
        cube[48] = cube_tmp[40];
        cube[49] = cube_tmp[35];
        cube[50] = cube_tmp[30];
        cube[51] = cube_tmp[1];
        cube[52] = cube_tmp[2];
        cube[53] = cube_tmp[3];
        cube[54] = cube_tmp[4];
        cube[55] = cube_tmp[5];
        cube[56] = cube_tmp[6];
        cube[57] = cube_tmp[7];
        cube[58] = cube_tmp[8];
        cube[59] = cube_tmp[9];
        cube[60] = cube_tmp[10];
        cube[61] = cube_tmp[11];
        cube[62] = cube_tmp[12];
        cube[63] = cube_tmp[13];
        cube[64] = cube_tmp[14];
        cube[65] = cube_tmp[15];
        cube[66] = cube_tmp[16];
        cube[67] = cube_tmp[17];
        cube[68] = cube_tmp[18];
        cube[69] = cube_tmp[19];
        cube[70] = cube_tmp[20];
        cube[71] = cube_tmp[21];
        cube[72] = cube_tmp[22];
        cube[73] = cube_tmp[23];
        cube[74] = cube_tmp[24];
        cube[75] = cube_tmp[25];
        cube[76] = cube_tmp[80];
        cube[77] = cube_tmp[85];
        cube[78] = cube_tmp[90];
        cube[79] = cube_tmp[95];
        cube[80] = cube_tmp[100];
        cube[81] = cube_tmp[79];
        cube[82] = cube_tmp[84];
        cube[83] = cube_tmp[89];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[99];
        cube[86] = cube_tmp[78];
        cube[87] = cube_tmp[83];
        cube[89] = cube_tmp[93];
        cube[90] = cube_tmp[98];
        cube[91] = cube_tmp[77];
        cube[92] = cube_tmp[82];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[92];
        cube[95] = cube_tmp[97];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[81];
        cube[98] = cube_tmp[86];
        cube[99] = cube_tmp[91];
        cube[100] = cube_tmp[96];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[149];
        cube[103] = cube_tmp[148];
        cube[104] = cube_tmp[147];
        cube[105] = cube_tmp[146];
        cube[106] = cube_tmp[145];
        cube[107] = cube_tmp[144];
        cube[108] = cube_tmp[143];
        cube[109] = cube_tmp[142];
        cube[110] = cube_tmp[141];
        cube[111] = cube_tmp[140];
        cube[112] = cube_tmp[139];
        cube[113] = cube_tmp[138];
        cube[114] = cube_tmp[137];
        cube[115] = cube_tmp[136];
        cube[116] = cube_tmp[135];
        cube[117] = cube_tmp[134];
        cube[118] = cube_tmp[133];
        cube[119] = cube_tmp[132];
        cube[120] = cube_tmp[131];
        cube[121] = cube_tmp[130];
        cube[122] = cube_tmp[129];
        cube[123] = cube_tmp[128];
        cube[124] = cube_tmp[127];
        cube[125] = cube_tmp[126];
        cube[126] = cube_tmp[51];
        cube[127] = cube_tmp[52];
        cube[128] = cube_tmp[53];
        cube[129] = cube_tmp[54];
        cube[130] = cube_tmp[55];
        cube[131] = cube_tmp[56];
        cube[132] = cube_tmp[57];
        cube[133] = cube_tmp[58];
        cube[134] = cube_tmp[59];
        cube[135] = cube_tmp[60];
        cube[136] = cube_tmp[61];
        cube[137] = cube_tmp[62];
        cube[138] = cube_tmp[63];
        cube[139] = cube_tmp[64];
        cube[140] = cube_tmp[65];
        cube[141] = cube_tmp[66];
        cube[142] = cube_tmp[67];
        cube[143] = cube_tmp[68];
        cube[144] = cube_tmp[69];
        cube[145] = cube_tmp[70];
        cube[146] = cube_tmp[71];
        cube[147] = cube_tmp[72];
        cube[148] = cube_tmp[73];
        cube[149] = cube_tmp[74];
        cube[150] = cube_tmp[75];
        break;

    case Y:
        cube[1] = cube_tmp[21];
        cube[2] = cube_tmp[16];
        cube[3] = cube_tmp[11];
        cube[4] = cube_tmp[6];
        cube[5] = cube_tmp[1];
        cube[6] = cube_tmp[22];
        cube[7] = cube_tmp[17];
        cube[8] = cube_tmp[12];
        cube[9] = cube_tmp[7];
        cube[10] = cube_tmp[2];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[18];
        cube[14] = cube_tmp[8];
        cube[15] = cube_tmp[3];
        cube[16] = cube_tmp[24];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[14];
        cube[19] = cube_tmp[9];
        cube[20] = cube_tmp[4];
        cube[21] = cube_tmp[25];
        cube[22] = cube_tmp[20];
        cube[23] = cube_tmp[15];
        cube[24] = cube_tmp[10];
        cube[25] = cube_tmp[5];
        cube[26] = cube_tmp[51];
        cube[27] = cube_tmp[52];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[54];
        cube[30] = cube_tmp[55];
        cube[31] = cube_tmp[56];
        cube[32] = cube_tmp[57];
        cube[33] = cube_tmp[58];
        cube[34] = cube_tmp[59];
        cube[35] = cube_tmp[60];
        cube[36] = cube_tmp[61];
        cube[37] = cube_tmp[62];
        cube[38] = cube_tmp[63];
        cube[39] = cube_tmp[64];
        cube[40] = cube_tmp[65];
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[67];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[69];
        cube[45] = cube_tmp[70];
        cube[46] = cube_tmp[71];
        cube[47] = cube_tmp[72];
        cube[48] = cube_tmp[73];
        cube[49] = cube_tmp[74];
        cube[50] = cube_tmp[75];
        cube[51] = cube_tmp[76];
        cube[52] = cube_tmp[77];
        cube[53] = cube_tmp[78];
        cube[54] = cube_tmp[79];
        cube[55] = cube_tmp[80];
        cube[56] = cube_tmp[81];
        cube[57] = cube_tmp[82];
        cube[58] = cube_tmp[83];
        cube[59] = cube_tmp[84];
        cube[60] = cube_tmp[85];
        cube[61] = cube_tmp[86];
        cube[62] = cube_tmp[87];
        cube[63] = cube_tmp[88];
        cube[64] = cube_tmp[89];
        cube[65] = cube_tmp[90];
        cube[66] = cube_tmp[91];
        cube[67] = cube_tmp[92];
        cube[68] = cube_tmp[93];
        cube[69] = cube_tmp[94];
        cube[70] = cube_tmp[95];
        cube[71] = cube_tmp[96];
        cube[72] = cube_tmp[97];
        cube[73] = cube_tmp[98];
        cube[74] = cube_tmp[99];
        cube[75] = cube_tmp[100];
        cube[76] = cube_tmp[101];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[105];
        cube[81] = cube_tmp[106];
        cube[82] = cube_tmp[107];
        cube[83] = cube_tmp[108];
        cube[84] = cube_tmp[109];
        cube[85] = cube_tmp[110];
        cube[86] = cube_tmp[111];
        cube[87] = cube_tmp[112];
        cube[88] = cube_tmp[113];
        cube[89] = cube_tmp[114];
        cube[90] = cube_tmp[115];
        cube[91] = cube_tmp[116];
        cube[92] = cube_tmp[117];
        cube[93] = cube_tmp[118];
        cube[94] = cube_tmp[119];
        cube[95] = cube_tmp[120];
        cube[96] = cube_tmp[121];
        cube[97] = cube_tmp[122];
        cube[98] = cube_tmp[123];
        cube[99] = cube_tmp[124];
        cube[100] = cube_tmp[125];
        cube[101] = cube_tmp[26];
        cube[102] = cube_tmp[27];
        cube[103] = cube_tmp[28];
        cube[104] = cube_tmp[29];
        cube[105] = cube_tmp[30];
        cube[106] = cube_tmp[31];
        cube[107] = cube_tmp[32];
        cube[108] = cube_tmp[33];
        cube[109] = cube_tmp[34];
        cube[110] = cube_tmp[35];
        cube[111] = cube_tmp[36];
        cube[112] = cube_tmp[37];
        cube[113] = cube_tmp[38];
        cube[114] = cube_tmp[39];
        cube[115] = cube_tmp[40];
        cube[116] = cube_tmp[41];
        cube[117] = cube_tmp[42];
        cube[118] = cube_tmp[43];
        cube[119] = cube_tmp[44];
        cube[120] = cube_tmp[45];
        cube[121] = cube_tmp[46];
        cube[122] = cube_tmp[47];
        cube[123] = cube_tmp[48];
        cube[124] = cube_tmp[49];
        cube[125] = cube_tmp[50];
        cube[126] = cube_tmp[130];
        cube[127] = cube_tmp[135];
        cube[128] = cube_tmp[140];
        cube[129] = cube_tmp[145];
        cube[130] = cube_tmp[150];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[134];
        cube[133] = cube_tmp[139];
        cube[134] = cube_tmp[144];
        cube[135] = cube_tmp[149];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[133];
        cube[139] = cube_tmp[143];
        cube[140] = cube_tmp[148];
        cube[141] = cube_tmp[127];
        cube[142] = cube_tmp[132];
        cube[143] = cube_tmp[137];
        cube[144] = cube_tmp[142];
        cube[145] = cube_tmp[147];
        cube[146] = cube_tmp[126];
        cube[147] = cube_tmp[131];
        cube[148] = cube_tmp[136];
        cube[149] = cube_tmp[141];
        cube[150] = cube_tmp[146];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[5];
        cube[2] = cube_tmp[10];
        cube[3] = cube_tmp[15];
        cube[4] = cube_tmp[20];
        cube[5] = cube_tmp[25];
        cube[6] = cube_tmp[4];
        cube[7] = cube_tmp[9];
        cube[8] = cube_tmp[14];
        cube[9] = cube_tmp[19];
        cube[10] = cube_tmp[24];
        cube[11] = cube_tmp[3];
        cube[12] = cube_tmp[8];
        cube[14] = cube_tmp[18];
        cube[15] = cube_tmp[23];
        cube[16] = cube_tmp[2];
        cube[17] = cube_tmp[7];
        cube[18] = cube_tmp[12];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[22];
        cube[21] = cube_tmp[1];
        cube[22] = cube_tmp[6];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[16];
        cube[25] = cube_tmp[21];
        cube[26] = cube_tmp[101];
        cube[27] = cube_tmp[102];
        cube[28] = cube_tmp[103];
        cube[29] = cube_tmp[104];
        cube[30] = cube_tmp[105];
        cube[31] = cube_tmp[106];
        cube[32] = cube_tmp[107];
        cube[33] = cube_tmp[108];
        cube[34] = cube_tmp[109];
        cube[35] = cube_tmp[110];
        cube[36] = cube_tmp[111];
        cube[37] = cube_tmp[112];
        cube[38] = cube_tmp[113];
        cube[39] = cube_tmp[114];
        cube[40] = cube_tmp[115];
        cube[41] = cube_tmp[116];
        cube[42] = cube_tmp[117];
        cube[43] = cube_tmp[118];
        cube[44] = cube_tmp[119];
        cube[45] = cube_tmp[120];
        cube[46] = cube_tmp[121];
        cube[47] = cube_tmp[122];
        cube[48] = cube_tmp[123];
        cube[49] = cube_tmp[124];
        cube[50] = cube_tmp[125];
        cube[51] = cube_tmp[26];
        cube[52] = cube_tmp[27];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[29];
        cube[55] = cube_tmp[30];
        cube[56] = cube_tmp[31];
        cube[57] = cube_tmp[32];
        cube[58] = cube_tmp[33];
        cube[59] = cube_tmp[34];
        cube[60] = cube_tmp[35];
        cube[61] = cube_tmp[36];
        cube[62] = cube_tmp[37];
        cube[63] = cube_tmp[38];
        cube[64] = cube_tmp[39];
        cube[65] = cube_tmp[40];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[42];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[44];
        cube[70] = cube_tmp[45];
        cube[71] = cube_tmp[46];
        cube[72] = cube_tmp[47];
        cube[73] = cube_tmp[48];
        cube[74] = cube_tmp[49];
        cube[75] = cube_tmp[50];
        cube[76] = cube_tmp[51];
        cube[77] = cube_tmp[52];
        cube[78] = cube_tmp[53];
        cube[79] = cube_tmp[54];
        cube[80] = cube_tmp[55];
        cube[81] = cube_tmp[56];
        cube[82] = cube_tmp[57];
        cube[83] = cube_tmp[58];
        cube[84] = cube_tmp[59];
        cube[85] = cube_tmp[60];
        cube[86] = cube_tmp[61];
        cube[87] = cube_tmp[62];
        cube[88] = cube_tmp[63];
        cube[89] = cube_tmp[64];
        cube[90] = cube_tmp[65];
        cube[91] = cube_tmp[66];
        cube[92] = cube_tmp[67];
        cube[93] = cube_tmp[68];
        cube[94] = cube_tmp[69];
        cube[95] = cube_tmp[70];
        cube[96] = cube_tmp[71];
        cube[97] = cube_tmp[72];
        cube[98] = cube_tmp[73];
        cube[99] = cube_tmp[74];
        cube[100] = cube_tmp[75];
        cube[101] = cube_tmp[76];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[80];
        cube[106] = cube_tmp[81];
        cube[107] = cube_tmp[82];
        cube[108] = cube_tmp[83];
        cube[109] = cube_tmp[84];
        cube[110] = cube_tmp[85];
        cube[111] = cube_tmp[86];
        cube[112] = cube_tmp[87];
        cube[113] = cube_tmp[88];
        cube[114] = cube_tmp[89];
        cube[115] = cube_tmp[90];
        cube[116] = cube_tmp[91];
        cube[117] = cube_tmp[92];
        cube[118] = cube_tmp[93];
        cube[119] = cube_tmp[94];
        cube[120] = cube_tmp[95];
        cube[121] = cube_tmp[96];
        cube[122] = cube_tmp[97];
        cube[123] = cube_tmp[98];
        cube[124] = cube_tmp[99];
        cube[125] = cube_tmp[100];
        cube[126] = cube_tmp[146];
        cube[127] = cube_tmp[141];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[126];
        cube[131] = cube_tmp[147];
        cube[132] = cube_tmp[142];
        cube[133] = cube_tmp[137];
        cube[134] = cube_tmp[132];
        cube[135] = cube_tmp[127];
        cube[136] = cube_tmp[148];
        cube[137] = cube_tmp[143];
        cube[139] = cube_tmp[133];
        cube[140] = cube_tmp[128];
        cube[141] = cube_tmp[149];
        cube[142] = cube_tmp[144];
        cube[143] = cube_tmp[139];
        cube[144] = cube_tmp[134];
        cube[145] = cube_tmp[129];
        cube[146] = cube_tmp[150];
        cube[147] = cube_tmp[145];
        cube[148] = cube_tmp[140];
        cube[149] = cube_tmp[135];
        cube[150] = cube_tmp[130];
        break;

    case Z:
        cube[1] = cube_tmp[46];
        cube[2] = cube_tmp[41];
        cube[3] = cube_tmp[36];
        cube[4] = cube_tmp[31];
        cube[5] = cube_tmp[26];
        cube[6] = cube_tmp[47];
        cube[7] = cube_tmp[42];
        cube[8] = cube_tmp[37];
        cube[9] = cube_tmp[32];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[48];
        cube[12] = cube_tmp[43];
        cube[13] = cube_tmp[38];
        cube[14] = cube_tmp[33];
        cube[15] = cube_tmp[28];
        cube[16] = cube_tmp[49];
        cube[17] = cube_tmp[44];
        cube[18] = cube_tmp[39];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[29];
        cube[21] = cube_tmp[50];
        cube[22] = cube_tmp[45];
        cube[23] = cube_tmp[40];
        cube[24] = cube_tmp[35];
        cube[25] = cube_tmp[30];
        cube[26] = cube_tmp[146];
        cube[27] = cube_tmp[141];
        cube[28] = cube_tmp[136];
        cube[29] = cube_tmp[131];
        cube[30] = cube_tmp[126];
        cube[31] = cube_tmp[147];
        cube[32] = cube_tmp[142];
        cube[33] = cube_tmp[137];
        cube[34] = cube_tmp[132];
        cube[35] = cube_tmp[127];
        cube[36] = cube_tmp[148];
        cube[37] = cube_tmp[143];
        cube[38] = cube_tmp[138];
        cube[39] = cube_tmp[133];
        cube[40] = cube_tmp[128];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[144];
        cube[43] = cube_tmp[139];
        cube[44] = cube_tmp[134];
        cube[45] = cube_tmp[129];
        cube[46] = cube_tmp[150];
        cube[47] = cube_tmp[145];
        cube[48] = cube_tmp[140];
        cube[49] = cube_tmp[135];
        cube[50] = cube_tmp[130];
        cube[51] = cube_tmp[71];
        cube[52] = cube_tmp[66];
        cube[53] = cube_tmp[61];
        cube[54] = cube_tmp[56];
        cube[55] = cube_tmp[51];
        cube[56] = cube_tmp[72];
        cube[57] = cube_tmp[67];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[57];
        cube[60] = cube_tmp[52];
        cube[61] = cube_tmp[73];
        cube[62] = cube_tmp[68];
        cube[64] = cube_tmp[58];
        cube[65] = cube_tmp[53];
        cube[66] = cube_tmp[74];
        cube[67] = cube_tmp[69];
        cube[68] = cube_tmp[64];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[75];
        cube[72] = cube_tmp[70];
        cube[73] = cube_tmp[65];
        cube[74] = cube_tmp[60];
        cube[75] = cube_tmp[55];
        cube[76] = cube_tmp[21];
        cube[77] = cube_tmp[16];
        cube[78] = cube_tmp[11];
        cube[79] = cube_tmp[6];
        cube[80] = cube_tmp[1];
        cube[81] = cube_tmp[22];
        cube[82] = cube_tmp[17];
        cube[83] = cube_tmp[12];
        cube[84] = cube_tmp[7];
        cube[85] = cube_tmp[2];
        cube[86] = cube_tmp[23];
        cube[87] = cube_tmp[18];
        cube[88] = cube_tmp[13];
        cube[89] = cube_tmp[8];
        cube[90] = cube_tmp[3];
        cube[91] = cube_tmp[24];
        cube[92] = cube_tmp[19];
        cube[93] = cube_tmp[14];
        cube[94] = cube_tmp[9];
        cube[95] = cube_tmp[4];
        cube[96] = cube_tmp[25];
        cube[97] = cube_tmp[20];
        cube[98] = cube_tmp[15];
        cube[99] = cube_tmp[10];
        cube[100] = cube_tmp[5];
        cube[101] = cube_tmp[105];
        cube[102] = cube_tmp[110];
        cube[103] = cube_tmp[115];
        cube[104] = cube_tmp[120];
        cube[105] = cube_tmp[125];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[109];
        cube[108] = cube_tmp[114];
        cube[109] = cube_tmp[119];
        cube[110] = cube_tmp[124];
        cube[111] = cube_tmp[103];
        cube[112] = cube_tmp[108];
        cube[114] = cube_tmp[118];
        cube[115] = cube_tmp[123];
        cube[116] = cube_tmp[102];
        cube[117] = cube_tmp[107];
        cube[118] = cube_tmp[112];
        cube[119] = cube_tmp[117];
        cube[120] = cube_tmp[122];
        cube[121] = cube_tmp[101];
        cube[122] = cube_tmp[106];
        cube[123] = cube_tmp[111];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[121];
        cube[126] = cube_tmp[96];
        cube[127] = cube_tmp[91];
        cube[128] = cube_tmp[86];
        cube[129] = cube_tmp[81];
        cube[130] = cube_tmp[76];
        cube[131] = cube_tmp[97];
        cube[132] = cube_tmp[92];
        cube[133] = cube_tmp[87];
        cube[134] = cube_tmp[82];
        cube[135] = cube_tmp[77];
        cube[136] = cube_tmp[98];
        cube[137] = cube_tmp[93];
        cube[138] = cube_tmp[88];
        cube[139] = cube_tmp[83];
        cube[140] = cube_tmp[78];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[94];
        cube[143] = cube_tmp[89];
        cube[144] = cube_tmp[84];
        cube[145] = cube_tmp[79];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[95];
        cube[148] = cube_tmp[90];
        cube[149] = cube_tmp[85];
        cube[150] = cube_tmp[80];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[80];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[90];
        cube[4] = cube_tmp[95];
        cube[5] = cube_tmp[100];
        cube[6] = cube_tmp[79];
        cube[7] = cube_tmp[84];
        cube[8] = cube_tmp[89];
        cube[9] = cube_tmp[94];
        cube[10] = cube_tmp[99];
        cube[11] = cube_tmp[78];
        cube[12] = cube_tmp[83];
        cube[13] = cube_tmp[88];
        cube[14] = cube_tmp[93];
        cube[15] = cube_tmp[98];
        cube[16] = cube_tmp[77];
        cube[17] = cube_tmp[82];
        cube[18] = cube_tmp[87];
        cube[19] = cube_tmp[92];
        cube[20] = cube_tmp[97];
        cube[21] = cube_tmp[76];
        cube[22] = cube_tmp[81];
        cube[23] = cube_tmp[86];
        cube[24] = cube_tmp[91];
        cube[25] = cube_tmp[96];
        cube[26] = cube_tmp[5];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[15];
        cube[29] = cube_tmp[20];
        cube[30] = cube_tmp[25];
        cube[31] = cube_tmp[4];
        cube[32] = cube_tmp[9];
        cube[33] = cube_tmp[14];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[24];
        cube[36] = cube_tmp[3];
        cube[37] = cube_tmp[8];
        cube[38] = cube_tmp[13];
        cube[39] = cube_tmp[18];
        cube[40] = cube_tmp[23];
        cube[41] = cube_tmp[2];
        cube[42] = cube_tmp[7];
        cube[43] = cube_tmp[12];
        cube[44] = cube_tmp[17];
        cube[45] = cube_tmp[22];
        cube[46] = cube_tmp[1];
        cube[47] = cube_tmp[6];
        cube[48] = cube_tmp[11];
        cube[49] = cube_tmp[16];
        cube[50] = cube_tmp[21];
        cube[51] = cube_tmp[55];
        cube[52] = cube_tmp[60];
        cube[53] = cube_tmp[65];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[75];
        cube[56] = cube_tmp[54];
        cube[57] = cube_tmp[59];
        cube[58] = cube_tmp[64];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[74];
        cube[61] = cube_tmp[53];
        cube[62] = cube_tmp[58];
        cube[64] = cube_tmp[68];
        cube[65] = cube_tmp[73];
        cube[66] = cube_tmp[52];
        cube[67] = cube_tmp[57];
        cube[68] = cube_tmp[62];
        cube[69] = cube_tmp[67];
        cube[70] = cube_tmp[72];
        cube[71] = cube_tmp[51];
        cube[72] = cube_tmp[56];
        cube[73] = cube_tmp[61];
        cube[74] = cube_tmp[66];
        cube[75] = cube_tmp[71];
        cube[76] = cube_tmp[130];
        cube[77] = cube_tmp[135];
        cube[78] = cube_tmp[140];
        cube[79] = cube_tmp[145];
        cube[80] = cube_tmp[150];
        cube[81] = cube_tmp[129];
        cube[82] = cube_tmp[134];
        cube[83] = cube_tmp[139];
        cube[84] = cube_tmp[144];
        cube[85] = cube_tmp[149];
        cube[86] = cube_tmp[128];
        cube[87] = cube_tmp[133];
        cube[88] = cube_tmp[138];
        cube[89] = cube_tmp[143];
        cube[90] = cube_tmp[148];
        cube[91] = cube_tmp[127];
        cube[92] = cube_tmp[132];
        cube[93] = cube_tmp[137];
        cube[94] = cube_tmp[142];
        cube[95] = cube_tmp[147];
        cube[96] = cube_tmp[126];
        cube[97] = cube_tmp[131];
        cube[98] = cube_tmp[136];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[121];
        cube[102] = cube_tmp[116];
        cube[103] = cube_tmp[111];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[101];
        cube[106] = cube_tmp[122];
        cube[107] = cube_tmp[117];
        cube[108] = cube_tmp[112];
        cube[109] = cube_tmp[107];
        cube[110] = cube_tmp[102];
        cube[111] = cube_tmp[123];
        cube[112] = cube_tmp[118];
        cube[114] = cube_tmp[108];
        cube[115] = cube_tmp[103];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[119];
        cube[118] = cube_tmp[114];
        cube[119] = cube_tmp[109];
        cube[120] = cube_tmp[104];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[120];
        cube[123] = cube_tmp[115];
        cube[124] = cube_tmp[110];
        cube[125] = cube_tmp[105];
        cube[126] = cube_tmp[30];
        cube[127] = cube_tmp[35];
        cube[128] = cube_tmp[40];
        cube[129] = cube_tmp[45];
        cube[130] = cube_tmp[50];
        cube[131] = cube_tmp[29];
        cube[132] = cube_tmp[34];
        cube[133] = cube_tmp[39];
        cube[134] = cube_tmp[44];
        cube[135] = cube_tmp[49];
        cube[136] = cube_tmp[28];
        cube[137] = cube_tmp[33];
        cube[138] = cube_tmp[38];
        cube[139] = cube_tmp[43];
        cube[140] = cube_tmp[48];
        cube[141] = cube_tmp[27];
        cube[142] = cube_tmp[32];
        cube[143] = cube_tmp[37];
        cube[144] = cube_tmp[42];
        cube[145] = cube_tmp[47];
        cube[146] = cube_tmp[26];
        cube[147] = cube_tmp[31];
        cube[148] = cube_tmp[36];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[46];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

void
rotate_666(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[31];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[19];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[1];
        cube[7] = cube_tmp[32];
        cube[8] = cube_tmp[26];
        cube[9] = cube_tmp[20];
        cube[10] = cube_tmp[14];
        cube[11] = cube_tmp[8];
        cube[12] = cube_tmp[2];
        cube[13] = cube_tmp[33];
        cube[14] = cube_tmp[27];
        cube[15] = cube_tmp[21];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[3];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[28];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[16];
        cube[23] = cube_tmp[10];
        cube[24] = cube_tmp[4];
        cube[25] = cube_tmp[35];
        cube[26] = cube_tmp[29];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[17];
        cube[29] = cube_tmp[11];
        cube[30] = cube_tmp[5];
        cube[31] = cube_tmp[36];
        cube[32] = cube_tmp[30];
        cube[33] = cube_tmp[24];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[12];
        cube[36] = cube_tmp[6];
        cube[37] = cube_tmp[73];
        cube[38] = cube_tmp[74];
        cube[39] = cube_tmp[75];
        cube[40] = cube_tmp[76];
        cube[41] = cube_tmp[77];
        cube[42] = cube_tmp[78];
        cube[73] = cube_tmp[109];
        cube[74] = cube_tmp[110];
        cube[75] = cube_tmp[111];
        cube[76] = cube_tmp[112];
        cube[77] = cube_tmp[113];
        cube[78] = cube_tmp[114];
        cube[109] = cube_tmp[145];
        cube[110] = cube_tmp[146];
        cube[111] = cube_tmp[147];
        cube[112] = cube_tmp[148];
        cube[113] = cube_tmp[149];
        cube[114] = cube_tmp[150];
        cube[145] = cube_tmp[37];
        cube[146] = cube_tmp[38];
        cube[147] = cube_tmp[39];
        cube[148] = cube_tmp[40];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[42];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[6];
        cube[2] = cube_tmp[12];
        cube[3] = cube_tmp[18];
        cube[4] = cube_tmp[24];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[36];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[11];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[23];
        cube[11] = cube_tmp[29];
        cube[12] = cube_tmp[35];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[10];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[22];
        cube[17] = cube_tmp[28];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[3];
        cube[20] = cube_tmp[9];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[33];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[8];
        cube[27] = cube_tmp[14];
        cube[28] = cube_tmp[20];
        cube[29] = cube_tmp[26];
        cube[30] = cube_tmp[32];
        cube[31] = cube_tmp[1];
        cube[32] = cube_tmp[7];
        cube[33] = cube_tmp[13];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[25];
        cube[36] = cube_tmp[31];
        cube[37] = cube_tmp[145];
        cube[38] = cube_tmp[146];
        cube[39] = cube_tmp[147];
        cube[40] = cube_tmp[148];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[150];
        cube[73] = cube_tmp[37];
        cube[74] = cube_tmp[38];
        cube[75] = cube_tmp[39];
        cube[76] = cube_tmp[40];
        cube[77] = cube_tmp[41];
        cube[78] = cube_tmp[42];
        cube[109] = cube_tmp[73];
        cube[110] = cube_tmp[74];
        cube[111] = cube_tmp[75];
        cube[112] = cube_tmp[76];
        cube[113] = cube_tmp[77];
        cube[114] = cube_tmp[78];
        cube[145] = cube_tmp[109];
        cube[146] = cube_tmp[110];
        cube[147] = cube_tmp[111];
        cube[148] = cube_tmp[112];
        cube[149] = cube_tmp[113];
        cube[150] = cube_tmp[114];
        break;

    case U2:
        cube[1] = cube_tmp[36];
        cube[2] = cube_tmp[35];
        cube[3] = cube_tmp[34];
        cube[4] = cube_tmp[33];
        cube[5] = cube_tmp[32];
        cube[6] = cube_tmp[31];
        cube[7] = cube_tmp[30];
        cube[8] = cube_tmp[29];
        cube[9] = cube_tmp[28];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[26];
        cube[12] = cube_tmp[25];
        cube[13] = cube_tmp[24];
        cube[14] = cube_tmp[23];
        cube[15] = cube_tmp[22];
        cube[16] = cube_tmp[21];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[19];
        cube[19] = cube_tmp[18];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[16];
        cube[22] = cube_tmp[15];
        cube[23] = cube_tmp[14];
        cube[24] = cube_tmp[13];
        cube[25] = cube_tmp[12];
        cube[26] = cube_tmp[11];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[9];
        cube[29] = cube_tmp[8];
        cube[30] = cube_tmp[7];
        cube[31] = cube_tmp[6];
        cube[32] = cube_tmp[5];
        cube[33] = cube_tmp[4];
        cube[34] = cube_tmp[3];
        cube[35] = cube_tmp[2];
        cube[36] = cube_tmp[1];
        cube[37] = cube_tmp[109];
        cube[38] = cube_tmp[110];
        cube[39] = cube_tmp[111];
        cube[40] = cube_tmp[112];
        cube[41] = cube_tmp[113];
        cube[42] = cube_tmp[114];
        cube[73] = cube_tmp[145];
        cube[74] = cube_tmp[146];
        cube[75] = cube_tmp[147];
        cube[76] = cube_tmp[148];
        cube[77] = cube_tmp[149];
        cube[78] = cube_tmp[150];
        cube[109] = cube_tmp[37];
        cube[110] = cube_tmp[38];
        cube[111] = cube_tmp[39];
        cube[112] = cube_tmp[40];
        cube[113] = cube_tmp[41];
        cube[114] = cube_tmp[42];
        cube[145] = cube_tmp[73];
        cube[146] = cube_tmp[74];
        cube[147] = cube_tmp[75];
        cube[148] = cube_tmp[76];
        cube[149] = cube_tmp[77];
        cube[150] = cube_tmp[78];
        break;

    case Uw:
        cube[1] = cube_tmp[31];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[19];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[1];
        cube[7] = cube_tmp[32];
        cube[8] = cube_tmp[26];
        cube[9] = cube_tmp[20];
        cube[10] = cube_tmp[14];
        cube[11] = cube_tmp[8];
        cube[12] = cube_tmp[2];
        cube[13] = cube_tmp[33];
        cube[14] = cube_tmp[27];
        cube[15] = cube_tmp[21];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[3];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[28];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[16];
        cube[23] = cube_tmp[10];
        cube[24] = cube_tmp[4];
        cube[25] = cube_tmp[35];
        cube[26] = cube_tmp[29];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[17];
        cube[29] = cube_tmp[11];
        cube[30] = cube_tmp[5];
        cube[31] = cube_tmp[36];
        cube[32] = cube_tmp[30];
        cube[33] = cube_tmp[24];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[12];
        cube[36] = cube_tmp[6];
        cube[37] = cube_tmp[73];
        cube[38] = cube_tmp[74];
        cube[39] = cube_tmp[75];
        cube[40] = cube_tmp[76];
        cube[41] = cube_tmp[77];
        cube[42] = cube_tmp[78];
        cube[43] = cube_tmp[79];
        cube[44] = cube_tmp[80];
        cube[45] = cube_tmp[81];
        cube[46] = cube_tmp[82];
        cube[47] = cube_tmp[83];
        cube[48] = cube_tmp[84];
        cube[73] = cube_tmp[109];
        cube[74] = cube_tmp[110];
        cube[75] = cube_tmp[111];
        cube[76] = cube_tmp[112];
        cube[77] = cube_tmp[113];
        cube[78] = cube_tmp[114];
        cube[79] = cube_tmp[115];
        cube[80] = cube_tmp[116];
        cube[81] = cube_tmp[117];
        cube[82] = cube_tmp[118];
        cube[83] = cube_tmp[119];
        cube[84] = cube_tmp[120];
        cube[109] = cube_tmp[145];
        cube[110] = cube_tmp[146];
        cube[111] = cube_tmp[147];
        cube[112] = cube_tmp[148];
        cube[113] = cube_tmp[149];
        cube[114] = cube_tmp[150];
        cube[115] = cube_tmp[151];
        cube[116] = cube_tmp[152];
        cube[117] = cube_tmp[153];
        cube[118] = cube_tmp[154];
        cube[119] = cube_tmp[155];
        cube[120] = cube_tmp[156];
        cube[145] = cube_tmp[37];
        cube[146] = cube_tmp[38];
        cube[147] = cube_tmp[39];
        cube[148] = cube_tmp[40];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[42];
        cube[151] = cube_tmp[43];
        cube[152] = cube_tmp[44];
        cube[153] = cube_tmp[45];
        cube[154] = cube_tmp[46];
        cube[155] = cube_tmp[47];
        cube[156] = cube_tmp[48];
        break;

    case Uw_PRIME:
        cube[1] = cube_tmp[6];
        cube[2] = cube_tmp[12];
        cube[3] = cube_tmp[18];
        cube[4] = cube_tmp[24];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[36];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[11];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[23];
        cube[11] = cube_tmp[29];
        cube[12] = cube_tmp[35];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[10];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[22];
        cube[17] = cube_tmp[28];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[3];
        cube[20] = cube_tmp[9];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[33];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[8];
        cube[27] = cube_tmp[14];
        cube[28] = cube_tmp[20];
        cube[29] = cube_tmp[26];
        cube[30] = cube_tmp[32];
        cube[31] = cube_tmp[1];
        cube[32] = cube_tmp[7];
        cube[33] = cube_tmp[13];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[25];
        cube[36] = cube_tmp[31];
        cube[37] = cube_tmp[145];
        cube[38] = cube_tmp[146];
        cube[39] = cube_tmp[147];
        cube[40] = cube_tmp[148];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[150];
        cube[43] = cube_tmp[151];
        cube[44] = cube_tmp[152];
        cube[45] = cube_tmp[153];
        cube[46] = cube_tmp[154];
        cube[47] = cube_tmp[155];
        cube[48] = cube_tmp[156];
        cube[73] = cube_tmp[37];
        cube[74] = cube_tmp[38];
        cube[75] = cube_tmp[39];
        cube[76] = cube_tmp[40];
        cube[77] = cube_tmp[41];
        cube[78] = cube_tmp[42];
        cube[79] = cube_tmp[43];
        cube[80] = cube_tmp[44];
        cube[81] = cube_tmp[45];
        cube[82] = cube_tmp[46];
        cube[83] = cube_tmp[47];
        cube[84] = cube_tmp[48];
        cube[109] = cube_tmp[73];
        cube[110] = cube_tmp[74];
        cube[111] = cube_tmp[75];
        cube[112] = cube_tmp[76];
        cube[113] = cube_tmp[77];
        cube[114] = cube_tmp[78];
        cube[115] = cube_tmp[79];
        cube[116] = cube_tmp[80];
        cube[117] = cube_tmp[81];
        cube[118] = cube_tmp[82];
        cube[119] = cube_tmp[83];
        cube[120] = cube_tmp[84];
        cube[145] = cube_tmp[109];
        cube[146] = cube_tmp[110];
        cube[147] = cube_tmp[111];
        cube[148] = cube_tmp[112];
        cube[149] = cube_tmp[113];
        cube[150] = cube_tmp[114];
        cube[151] = cube_tmp[115];
        cube[152] = cube_tmp[116];
        cube[153] = cube_tmp[117];
        cube[154] = cube_tmp[118];
        cube[155] = cube_tmp[119];
        cube[156] = cube_tmp[120];
        break;

    case Uw2:
        cube[1] = cube_tmp[36];
        cube[2] = cube_tmp[35];
        cube[3] = cube_tmp[34];
        cube[4] = cube_tmp[33];
        cube[5] = cube_tmp[32];
        cube[6] = cube_tmp[31];
        cube[7] = cube_tmp[30];
        cube[8] = cube_tmp[29];
        cube[9] = cube_tmp[28];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[26];
        cube[12] = cube_tmp[25];
        cube[13] = cube_tmp[24];
        cube[14] = cube_tmp[23];
        cube[15] = cube_tmp[22];
        cube[16] = cube_tmp[21];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[19];
        cube[19] = cube_tmp[18];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[16];
        cube[22] = cube_tmp[15];
        cube[23] = cube_tmp[14];
        cube[24] = cube_tmp[13];
        cube[25] = cube_tmp[12];
        cube[26] = cube_tmp[11];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[9];
        cube[29] = cube_tmp[8];
        cube[30] = cube_tmp[7];
        cube[31] = cube_tmp[6];
        cube[32] = cube_tmp[5];
        cube[33] = cube_tmp[4];
        cube[34] = cube_tmp[3];
        cube[35] = cube_tmp[2];
        cube[36] = cube_tmp[1];
        cube[37] = cube_tmp[109];
        cube[38] = cube_tmp[110];
        cube[39] = cube_tmp[111];
        cube[40] = cube_tmp[112];
        cube[41] = cube_tmp[113];
        cube[42] = cube_tmp[114];
        cube[43] = cube_tmp[115];
        cube[44] = cube_tmp[116];
        cube[45] = cube_tmp[117];
        cube[46] = cube_tmp[118];
        cube[47] = cube_tmp[119];
        cube[48] = cube_tmp[120];
        cube[73] = cube_tmp[145];
        cube[74] = cube_tmp[146];
        cube[75] = cube_tmp[147];
        cube[76] = cube_tmp[148];
        cube[77] = cube_tmp[149];
        cube[78] = cube_tmp[150];
        cube[79] = cube_tmp[151];
        cube[80] = cube_tmp[152];
        cube[81] = cube_tmp[153];
        cube[82] = cube_tmp[154];
        cube[83] = cube_tmp[155];
        cube[84] = cube_tmp[156];
        cube[109] = cube_tmp[37];
        cube[110] = cube_tmp[38];
        cube[111] = cube_tmp[39];
        cube[112] = cube_tmp[40];
        cube[113] = cube_tmp[41];
        cube[114] = cube_tmp[42];
        cube[115] = cube_tmp[43];
        cube[116] = cube_tmp[44];
        cube[117] = cube_tmp[45];
        cube[118] = cube_tmp[46];
        cube[119] = cube_tmp[47];
        cube[120] = cube_tmp[48];
        cube[145] = cube_tmp[73];
        cube[146] = cube_tmp[74];
        cube[147] = cube_tmp[75];
        cube[148] = cube_tmp[76];
        cube[149] = cube_tmp[77];
        cube[150] = cube_tmp[78];
        cube[151] = cube_tmp[79];
        cube[152] = cube_tmp[80];
        cube[153] = cube_tmp[81];
        cube[154] = cube_tmp[82];
        cube[155] = cube_tmp[83];
        cube[156] = cube_tmp[84];
        break;

    case threeUw:
        cube[1] = cube_tmp[31];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[19];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[1];
        cube[7] = cube_tmp[32];
        cube[8] = cube_tmp[26];
        cube[9] = cube_tmp[20];
        cube[10] = cube_tmp[14];
        cube[11] = cube_tmp[8];
        cube[12] = cube_tmp[2];
        cube[13] = cube_tmp[33];
        cube[14] = cube_tmp[27];
        cube[15] = cube_tmp[21];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[3];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[28];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[16];
        cube[23] = cube_tmp[10];
        cube[24] = cube_tmp[4];
        cube[25] = cube_tmp[35];
        cube[26] = cube_tmp[29];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[17];
        cube[29] = cube_tmp[11];
        cube[30] = cube_tmp[5];
        cube[31] = cube_tmp[36];
        cube[32] = cube_tmp[30];
        cube[33] = cube_tmp[24];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[12];
        cube[36] = cube_tmp[6];
        cube[37] = cube_tmp[73];
        cube[38] = cube_tmp[74];
        cube[39] = cube_tmp[75];
        cube[40] = cube_tmp[76];
        cube[41] = cube_tmp[77];
        cube[42] = cube_tmp[78];
        cube[43] = cube_tmp[79];
        cube[44] = cube_tmp[80];
        cube[45] = cube_tmp[81];
        cube[46] = cube_tmp[82];
        cube[47] = cube_tmp[83];
        cube[48] = cube_tmp[84];
        cube[49] = cube_tmp[85];
        cube[50] = cube_tmp[86];
        cube[51] = cube_tmp[87];
        cube[52] = cube_tmp[88];
        cube[53] = cube_tmp[89];
        cube[54] = cube_tmp[90];
        cube[73] = cube_tmp[109];
        cube[74] = cube_tmp[110];
        cube[75] = cube_tmp[111];
        cube[76] = cube_tmp[112];
        cube[77] = cube_tmp[113];
        cube[78] = cube_tmp[114];
        cube[79] = cube_tmp[115];
        cube[80] = cube_tmp[116];
        cube[81] = cube_tmp[117];
        cube[82] = cube_tmp[118];
        cube[83] = cube_tmp[119];
        cube[84] = cube_tmp[120];
        cube[85] = cube_tmp[121];
        cube[86] = cube_tmp[122];
        cube[87] = cube_tmp[123];
        cube[88] = cube_tmp[124];
        cube[89] = cube_tmp[125];
        cube[90] = cube_tmp[126];
        cube[109] = cube_tmp[145];
        cube[110] = cube_tmp[146];
        cube[111] = cube_tmp[147];
        cube[112] = cube_tmp[148];
        cube[113] = cube_tmp[149];
        cube[114] = cube_tmp[150];
        cube[115] = cube_tmp[151];
        cube[116] = cube_tmp[152];
        cube[117] = cube_tmp[153];
        cube[118] = cube_tmp[154];
        cube[119] = cube_tmp[155];
        cube[120] = cube_tmp[156];
        cube[121] = cube_tmp[157];
        cube[122] = cube_tmp[158];
        cube[123] = cube_tmp[159];
        cube[124] = cube_tmp[160];
        cube[125] = cube_tmp[161];
        cube[126] = cube_tmp[162];
        cube[145] = cube_tmp[37];
        cube[146] = cube_tmp[38];
        cube[147] = cube_tmp[39];
        cube[148] = cube_tmp[40];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[42];
        cube[151] = cube_tmp[43];
        cube[152] = cube_tmp[44];
        cube[153] = cube_tmp[45];
        cube[154] = cube_tmp[46];
        cube[155] = cube_tmp[47];
        cube[156] = cube_tmp[48];
        cube[157] = cube_tmp[49];
        cube[158] = cube_tmp[50];
        cube[159] = cube_tmp[51];
        cube[160] = cube_tmp[52];
        cube[161] = cube_tmp[53];
        cube[162] = cube_tmp[54];
        break;

    case threeUw_PRIME:
        cube[1] = cube_tmp[6];
        cube[2] = cube_tmp[12];
        cube[3] = cube_tmp[18];
        cube[4] = cube_tmp[24];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[36];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[11];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[23];
        cube[11] = cube_tmp[29];
        cube[12] = cube_tmp[35];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[10];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[22];
        cube[17] = cube_tmp[28];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[3];
        cube[20] = cube_tmp[9];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[33];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[8];
        cube[27] = cube_tmp[14];
        cube[28] = cube_tmp[20];
        cube[29] = cube_tmp[26];
        cube[30] = cube_tmp[32];
        cube[31] = cube_tmp[1];
        cube[32] = cube_tmp[7];
        cube[33] = cube_tmp[13];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[25];
        cube[36] = cube_tmp[31];
        cube[37] = cube_tmp[145];
        cube[38] = cube_tmp[146];
        cube[39] = cube_tmp[147];
        cube[40] = cube_tmp[148];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[150];
        cube[43] = cube_tmp[151];
        cube[44] = cube_tmp[152];
        cube[45] = cube_tmp[153];
        cube[46] = cube_tmp[154];
        cube[47] = cube_tmp[155];
        cube[48] = cube_tmp[156];
        cube[49] = cube_tmp[157];
        cube[50] = cube_tmp[158];
        cube[51] = cube_tmp[159];
        cube[52] = cube_tmp[160];
        cube[53] = cube_tmp[161];
        cube[54] = cube_tmp[162];
        cube[73] = cube_tmp[37];
        cube[74] = cube_tmp[38];
        cube[75] = cube_tmp[39];
        cube[76] = cube_tmp[40];
        cube[77] = cube_tmp[41];
        cube[78] = cube_tmp[42];
        cube[79] = cube_tmp[43];
        cube[80] = cube_tmp[44];
        cube[81] = cube_tmp[45];
        cube[82] = cube_tmp[46];
        cube[83] = cube_tmp[47];
        cube[84] = cube_tmp[48];
        cube[85] = cube_tmp[49];
        cube[86] = cube_tmp[50];
        cube[87] = cube_tmp[51];
        cube[88] = cube_tmp[52];
        cube[89] = cube_tmp[53];
        cube[90] = cube_tmp[54];
        cube[109] = cube_tmp[73];
        cube[110] = cube_tmp[74];
        cube[111] = cube_tmp[75];
        cube[112] = cube_tmp[76];
        cube[113] = cube_tmp[77];
        cube[114] = cube_tmp[78];
        cube[115] = cube_tmp[79];
        cube[116] = cube_tmp[80];
        cube[117] = cube_tmp[81];
        cube[118] = cube_tmp[82];
        cube[119] = cube_tmp[83];
        cube[120] = cube_tmp[84];
        cube[121] = cube_tmp[85];
        cube[122] = cube_tmp[86];
        cube[123] = cube_tmp[87];
        cube[124] = cube_tmp[88];
        cube[125] = cube_tmp[89];
        cube[126] = cube_tmp[90];
        cube[145] = cube_tmp[109];
        cube[146] = cube_tmp[110];
        cube[147] = cube_tmp[111];
        cube[148] = cube_tmp[112];
        cube[149] = cube_tmp[113];
        cube[150] = cube_tmp[114];
        cube[151] = cube_tmp[115];
        cube[152] = cube_tmp[116];
        cube[153] = cube_tmp[117];
        cube[154] = cube_tmp[118];
        cube[155] = cube_tmp[119];
        cube[156] = cube_tmp[120];
        cube[157] = cube_tmp[121];
        cube[158] = cube_tmp[122];
        cube[159] = cube_tmp[123];
        cube[160] = cube_tmp[124];
        cube[161] = cube_tmp[125];
        cube[162] = cube_tmp[126];
        break;

    case threeUw2:
        cube[1] = cube_tmp[36];
        cube[2] = cube_tmp[35];
        cube[3] = cube_tmp[34];
        cube[4] = cube_tmp[33];
        cube[5] = cube_tmp[32];
        cube[6] = cube_tmp[31];
        cube[7] = cube_tmp[30];
        cube[8] = cube_tmp[29];
        cube[9] = cube_tmp[28];
        cube[10] = cube_tmp[27];
        cube[11] = cube_tmp[26];
        cube[12] = cube_tmp[25];
        cube[13] = cube_tmp[24];
        cube[14] = cube_tmp[23];
        cube[15] = cube_tmp[22];
        cube[16] = cube_tmp[21];
        cube[17] = cube_tmp[20];
        cube[18] = cube_tmp[19];
        cube[19] = cube_tmp[18];
        cube[20] = cube_tmp[17];
        cube[21] = cube_tmp[16];
        cube[22] = cube_tmp[15];
        cube[23] = cube_tmp[14];
        cube[24] = cube_tmp[13];
        cube[25] = cube_tmp[12];
        cube[26] = cube_tmp[11];
        cube[27] = cube_tmp[10];
        cube[28] = cube_tmp[9];
        cube[29] = cube_tmp[8];
        cube[30] = cube_tmp[7];
        cube[31] = cube_tmp[6];
        cube[32] = cube_tmp[5];
        cube[33] = cube_tmp[4];
        cube[34] = cube_tmp[3];
        cube[35] = cube_tmp[2];
        cube[36] = cube_tmp[1];
        cube[37] = cube_tmp[109];
        cube[38] = cube_tmp[110];
        cube[39] = cube_tmp[111];
        cube[40] = cube_tmp[112];
        cube[41] = cube_tmp[113];
        cube[42] = cube_tmp[114];
        cube[43] = cube_tmp[115];
        cube[44] = cube_tmp[116];
        cube[45] = cube_tmp[117];
        cube[46] = cube_tmp[118];
        cube[47] = cube_tmp[119];
        cube[48] = cube_tmp[120];
        cube[49] = cube_tmp[121];
        cube[50] = cube_tmp[122];
        cube[51] = cube_tmp[123];
        cube[52] = cube_tmp[124];
        cube[53] = cube_tmp[125];
        cube[54] = cube_tmp[126];
        cube[73] = cube_tmp[145];
        cube[74] = cube_tmp[146];
        cube[75] = cube_tmp[147];
        cube[76] = cube_tmp[148];
        cube[77] = cube_tmp[149];
        cube[78] = cube_tmp[150];
        cube[79] = cube_tmp[151];
        cube[80] = cube_tmp[152];
        cube[81] = cube_tmp[153];
        cube[82] = cube_tmp[154];
        cube[83] = cube_tmp[155];
        cube[84] = cube_tmp[156];
        cube[85] = cube_tmp[157];
        cube[86] = cube_tmp[158];
        cube[87] = cube_tmp[159];
        cube[88] = cube_tmp[160];
        cube[89] = cube_tmp[161];
        cube[90] = cube_tmp[162];
        cube[109] = cube_tmp[37];
        cube[110] = cube_tmp[38];
        cube[111] = cube_tmp[39];
        cube[112] = cube_tmp[40];
        cube[113] = cube_tmp[41];
        cube[114] = cube_tmp[42];
        cube[115] = cube_tmp[43];
        cube[116] = cube_tmp[44];
        cube[117] = cube_tmp[45];
        cube[118] = cube_tmp[46];
        cube[119] = cube_tmp[47];
        cube[120] = cube_tmp[48];
        cube[121] = cube_tmp[49];
        cube[122] = cube_tmp[50];
        cube[123] = cube_tmp[51];
        cube[124] = cube_tmp[52];
        cube[125] = cube_tmp[53];
        cube[126] = cube_tmp[54];
        cube[145] = cube_tmp[73];
        cube[146] = cube_tmp[74];
        cube[147] = cube_tmp[75];
        cube[148] = cube_tmp[76];
        cube[149] = cube_tmp[77];
        cube[150] = cube_tmp[78];
        cube[151] = cube_tmp[79];
        cube[152] = cube_tmp[80];
        cube[153] = cube_tmp[81];
        cube[154] = cube_tmp[82];
        cube[155] = cube_tmp[83];
        cube[156] = cube_tmp[84];
        cube[157] = cube_tmp[85];
        cube[158] = cube_tmp[86];
        cube[159] = cube_tmp[87];
        cube[160] = cube_tmp[88];
        cube[161] = cube_tmp[89];
        cube[162] = cube_tmp[90];
        break;

    case L:
        cube[1] = cube_tmp[180];
        cube[7] = cube_tmp[174];
        cube[13] = cube_tmp[168];
        cube[19] = cube_tmp[162];
        cube[25] = cube_tmp[156];
        cube[31] = cube_tmp[150];
        cube[37] = cube_tmp[67];
        cube[38] = cube_tmp[61];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[49];
        cube[41] = cube_tmp[43];
        cube[42] = cube_tmp[37];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[62];
        cube[45] = cube_tmp[56];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[44];
        cube[48] = cube_tmp[38];
        cube[49] = cube_tmp[69];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[57];
        cube[52] = cube_tmp[51];
        cube[53] = cube_tmp[45];
        cube[54] = cube_tmp[39];
        cube[55] = cube_tmp[70];
        cube[56] = cube_tmp[64];
        cube[57] = cube_tmp[58];
        cube[58] = cube_tmp[52];
        cube[59] = cube_tmp[46];
        cube[60] = cube_tmp[40];
        cube[61] = cube_tmp[71];
        cube[62] = cube_tmp[65];
        cube[63] = cube_tmp[59];
        cube[64] = cube_tmp[53];
        cube[65] = cube_tmp[47];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[72];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[60];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[48];
        cube[72] = cube_tmp[42];
        cube[73] = cube_tmp[1];
        cube[79] = cube_tmp[7];
        cube[85] = cube_tmp[13];
        cube[91] = cube_tmp[19];
        cube[97] = cube_tmp[25];
        cube[103] = cube_tmp[31];
        cube[150] = cube_tmp[211];
        cube[156] = cube_tmp[205];
        cube[162] = cube_tmp[199];
        cube[168] = cube_tmp[193];
        cube[174] = cube_tmp[187];
        cube[180] = cube_tmp[181];
        cube[181] = cube_tmp[73];
        cube[187] = cube_tmp[79];
        cube[193] = cube_tmp[85];
        cube[199] = cube_tmp[91];
        cube[205] = cube_tmp[97];
        cube[211] = cube_tmp[103];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[73];
        cube[7] = cube_tmp[79];
        cube[13] = cube_tmp[85];
        cube[19] = cube_tmp[91];
        cube[25] = cube_tmp[97];
        cube[31] = cube_tmp[103];
        cube[37] = cube_tmp[42];
        cube[38] = cube_tmp[48];
        cube[39] = cube_tmp[54];
        cube[40] = cube_tmp[60];
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[72];
        cube[43] = cube_tmp[41];
        cube[44] = cube_tmp[47];
        cube[45] = cube_tmp[53];
        cube[46] = cube_tmp[59];
        cube[47] = cube_tmp[65];
        cube[48] = cube_tmp[71];
        cube[49] = cube_tmp[40];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[52];
        cube[52] = cube_tmp[58];
        cube[53] = cube_tmp[64];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[45];
        cube[57] = cube_tmp[51];
        cube[58] = cube_tmp[57];
        cube[59] = cube_tmp[63];
        cube[60] = cube_tmp[69];
        cube[61] = cube_tmp[38];
        cube[62] = cube_tmp[44];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[56];
        cube[65] = cube_tmp[62];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[37];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[49];
        cube[70] = cube_tmp[55];
        cube[71] = cube_tmp[61];
        cube[72] = cube_tmp[67];
        cube[73] = cube_tmp[181];
        cube[79] = cube_tmp[187];
        cube[85] = cube_tmp[193];
        cube[91] = cube_tmp[199];
        cube[97] = cube_tmp[205];
        cube[103] = cube_tmp[211];
        cube[150] = cube_tmp[31];
        cube[156] = cube_tmp[25];
        cube[162] = cube_tmp[19];
        cube[168] = cube_tmp[13];
        cube[174] = cube_tmp[7];
        cube[180] = cube_tmp[1];
        cube[181] = cube_tmp[180];
        cube[187] = cube_tmp[174];
        cube[193] = cube_tmp[168];
        cube[199] = cube_tmp[162];
        cube[205] = cube_tmp[156];
        cube[211] = cube_tmp[150];
        break;

    case L2:
        cube[1] = cube_tmp[181];
        cube[7] = cube_tmp[187];
        cube[13] = cube_tmp[193];
        cube[19] = cube_tmp[199];
        cube[25] = cube_tmp[205];
        cube[31] = cube_tmp[211];
        cube[37] = cube_tmp[72];
        cube[38] = cube_tmp[71];
        cube[39] = cube_tmp[70];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[68];
        cube[42] = cube_tmp[67];
        cube[43] = cube_tmp[66];
        cube[44] = cube_tmp[65];
        cube[45] = cube_tmp[64];
        cube[46] = cube_tmp[63];
        cube[47] = cube_tmp[62];
        cube[48] = cube_tmp[61];
        cube[49] = cube_tmp[60];
        cube[50] = cube_tmp[59];
        cube[51] = cube_tmp[58];
        cube[52] = cube_tmp[57];
        cube[53] = cube_tmp[56];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[53];
        cube[57] = cube_tmp[52];
        cube[58] = cube_tmp[51];
        cube[59] = cube_tmp[50];
        cube[60] = cube_tmp[49];
        cube[61] = cube_tmp[48];
        cube[62] = cube_tmp[47];
        cube[63] = cube_tmp[46];
        cube[64] = cube_tmp[45];
        cube[65] = cube_tmp[44];
        cube[66] = cube_tmp[43];
        cube[67] = cube_tmp[42];
        cube[68] = cube_tmp[41];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[39];
        cube[71] = cube_tmp[38];
        cube[72] = cube_tmp[37];
        cube[73] = cube_tmp[180];
        cube[79] = cube_tmp[174];
        cube[85] = cube_tmp[168];
        cube[91] = cube_tmp[162];
        cube[97] = cube_tmp[156];
        cube[103] = cube_tmp[150];
        cube[150] = cube_tmp[103];
        cube[156] = cube_tmp[97];
        cube[162] = cube_tmp[91];
        cube[168] = cube_tmp[85];
        cube[174] = cube_tmp[79];
        cube[180] = cube_tmp[73];
        cube[181] = cube_tmp[1];
        cube[187] = cube_tmp[7];
        cube[193] = cube_tmp[13];
        cube[199] = cube_tmp[19];
        cube[205] = cube_tmp[25];
        cube[211] = cube_tmp[31];
        break;

    case Lw:
        cube[1] = cube_tmp[180];
        cube[2] = cube_tmp[179];
        cube[7] = cube_tmp[174];
        cube[8] = cube_tmp[173];
        cube[13] = cube_tmp[168];
        cube[14] = cube_tmp[167];
        cube[19] = cube_tmp[162];
        cube[20] = cube_tmp[161];
        cube[25] = cube_tmp[156];
        cube[26] = cube_tmp[155];
        cube[31] = cube_tmp[150];
        cube[32] = cube_tmp[149];
        cube[37] = cube_tmp[67];
        cube[38] = cube_tmp[61];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[49];
        cube[41] = cube_tmp[43];
        cube[42] = cube_tmp[37];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[62];
        cube[45] = cube_tmp[56];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[44];
        cube[48] = cube_tmp[38];
        cube[49] = cube_tmp[69];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[57];
        cube[52] = cube_tmp[51];
        cube[53] = cube_tmp[45];
        cube[54] = cube_tmp[39];
        cube[55] = cube_tmp[70];
        cube[56] = cube_tmp[64];
        cube[57] = cube_tmp[58];
        cube[58] = cube_tmp[52];
        cube[59] = cube_tmp[46];
        cube[60] = cube_tmp[40];
        cube[61] = cube_tmp[71];
        cube[62] = cube_tmp[65];
        cube[63] = cube_tmp[59];
        cube[64] = cube_tmp[53];
        cube[65] = cube_tmp[47];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[72];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[60];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[48];
        cube[72] = cube_tmp[42];
        cube[73] = cube_tmp[1];
        cube[74] = cube_tmp[2];
        cube[79] = cube_tmp[7];
        cube[80] = cube_tmp[8];
        cube[85] = cube_tmp[13];
        cube[86] = cube_tmp[14];
        cube[91] = cube_tmp[19];
        cube[92] = cube_tmp[20];
        cube[97] = cube_tmp[25];
        cube[98] = cube_tmp[26];
        cube[103] = cube_tmp[31];
        cube[104] = cube_tmp[32];
        cube[149] = cube_tmp[212];
        cube[150] = cube_tmp[211];
        cube[155] = cube_tmp[206];
        cube[156] = cube_tmp[205];
        cube[161] = cube_tmp[200];
        cube[162] = cube_tmp[199];
        cube[167] = cube_tmp[194];
        cube[168] = cube_tmp[193];
        cube[173] = cube_tmp[188];
        cube[174] = cube_tmp[187];
        cube[179] = cube_tmp[182];
        cube[180] = cube_tmp[181];
        cube[181] = cube_tmp[73];
        cube[182] = cube_tmp[74];
        cube[187] = cube_tmp[79];
        cube[188] = cube_tmp[80];
        cube[193] = cube_tmp[85];
        cube[194] = cube_tmp[86];
        cube[199] = cube_tmp[91];
        cube[200] = cube_tmp[92];
        cube[205] = cube_tmp[97];
        cube[206] = cube_tmp[98];
        cube[211] = cube_tmp[103];
        cube[212] = cube_tmp[104];
        break;

    case Lw_PRIME:
        cube[1] = cube_tmp[73];
        cube[2] = cube_tmp[74];
        cube[7] = cube_tmp[79];
        cube[8] = cube_tmp[80];
        cube[13] = cube_tmp[85];
        cube[14] = cube_tmp[86];
        cube[19] = cube_tmp[91];
        cube[20] = cube_tmp[92];
        cube[25] = cube_tmp[97];
        cube[26] = cube_tmp[98];
        cube[31] = cube_tmp[103];
        cube[32] = cube_tmp[104];
        cube[37] = cube_tmp[42];
        cube[38] = cube_tmp[48];
        cube[39] = cube_tmp[54];
        cube[40] = cube_tmp[60];
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[72];
        cube[43] = cube_tmp[41];
        cube[44] = cube_tmp[47];
        cube[45] = cube_tmp[53];
        cube[46] = cube_tmp[59];
        cube[47] = cube_tmp[65];
        cube[48] = cube_tmp[71];
        cube[49] = cube_tmp[40];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[52];
        cube[52] = cube_tmp[58];
        cube[53] = cube_tmp[64];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[45];
        cube[57] = cube_tmp[51];
        cube[58] = cube_tmp[57];
        cube[59] = cube_tmp[63];
        cube[60] = cube_tmp[69];
        cube[61] = cube_tmp[38];
        cube[62] = cube_tmp[44];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[56];
        cube[65] = cube_tmp[62];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[37];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[49];
        cube[70] = cube_tmp[55];
        cube[71] = cube_tmp[61];
        cube[72] = cube_tmp[67];
        cube[73] = cube_tmp[181];
        cube[74] = cube_tmp[182];
        cube[79] = cube_tmp[187];
        cube[80] = cube_tmp[188];
        cube[85] = cube_tmp[193];
        cube[86] = cube_tmp[194];
        cube[91] = cube_tmp[199];
        cube[92] = cube_tmp[200];
        cube[97] = cube_tmp[205];
        cube[98] = cube_tmp[206];
        cube[103] = cube_tmp[211];
        cube[104] = cube_tmp[212];
        cube[149] = cube_tmp[32];
        cube[150] = cube_tmp[31];
        cube[155] = cube_tmp[26];
        cube[156] = cube_tmp[25];
        cube[161] = cube_tmp[20];
        cube[162] = cube_tmp[19];
        cube[167] = cube_tmp[14];
        cube[168] = cube_tmp[13];
        cube[173] = cube_tmp[8];
        cube[174] = cube_tmp[7];
        cube[179] = cube_tmp[2];
        cube[180] = cube_tmp[1];
        cube[181] = cube_tmp[180];
        cube[182] = cube_tmp[179];
        cube[187] = cube_tmp[174];
        cube[188] = cube_tmp[173];
        cube[193] = cube_tmp[168];
        cube[194] = cube_tmp[167];
        cube[199] = cube_tmp[162];
        cube[200] = cube_tmp[161];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[155];
        cube[211] = cube_tmp[150];
        cube[212] = cube_tmp[149];
        break;

    case Lw2:
        cube[1] = cube_tmp[181];
        cube[2] = cube_tmp[182];
        cube[7] = cube_tmp[187];
        cube[8] = cube_tmp[188];
        cube[13] = cube_tmp[193];
        cube[14] = cube_tmp[194];
        cube[19] = cube_tmp[199];
        cube[20] = cube_tmp[200];
        cube[25] = cube_tmp[205];
        cube[26] = cube_tmp[206];
        cube[31] = cube_tmp[211];
        cube[32] = cube_tmp[212];
        cube[37] = cube_tmp[72];
        cube[38] = cube_tmp[71];
        cube[39] = cube_tmp[70];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[68];
        cube[42] = cube_tmp[67];
        cube[43] = cube_tmp[66];
        cube[44] = cube_tmp[65];
        cube[45] = cube_tmp[64];
        cube[46] = cube_tmp[63];
        cube[47] = cube_tmp[62];
        cube[48] = cube_tmp[61];
        cube[49] = cube_tmp[60];
        cube[50] = cube_tmp[59];
        cube[51] = cube_tmp[58];
        cube[52] = cube_tmp[57];
        cube[53] = cube_tmp[56];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[53];
        cube[57] = cube_tmp[52];
        cube[58] = cube_tmp[51];
        cube[59] = cube_tmp[50];
        cube[60] = cube_tmp[49];
        cube[61] = cube_tmp[48];
        cube[62] = cube_tmp[47];
        cube[63] = cube_tmp[46];
        cube[64] = cube_tmp[45];
        cube[65] = cube_tmp[44];
        cube[66] = cube_tmp[43];
        cube[67] = cube_tmp[42];
        cube[68] = cube_tmp[41];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[39];
        cube[71] = cube_tmp[38];
        cube[72] = cube_tmp[37];
        cube[73] = cube_tmp[180];
        cube[74] = cube_tmp[179];
        cube[79] = cube_tmp[174];
        cube[80] = cube_tmp[173];
        cube[85] = cube_tmp[168];
        cube[86] = cube_tmp[167];
        cube[91] = cube_tmp[162];
        cube[92] = cube_tmp[161];
        cube[97] = cube_tmp[156];
        cube[98] = cube_tmp[155];
        cube[103] = cube_tmp[150];
        cube[104] = cube_tmp[149];
        cube[149] = cube_tmp[104];
        cube[150] = cube_tmp[103];
        cube[155] = cube_tmp[98];
        cube[156] = cube_tmp[97];
        cube[161] = cube_tmp[92];
        cube[162] = cube_tmp[91];
        cube[167] = cube_tmp[86];
        cube[168] = cube_tmp[85];
        cube[173] = cube_tmp[80];
        cube[174] = cube_tmp[79];
        cube[179] = cube_tmp[74];
        cube[180] = cube_tmp[73];
        cube[181] = cube_tmp[1];
        cube[182] = cube_tmp[2];
        cube[187] = cube_tmp[7];
        cube[188] = cube_tmp[8];
        cube[193] = cube_tmp[13];
        cube[194] = cube_tmp[14];
        cube[199] = cube_tmp[19];
        cube[200] = cube_tmp[20];
        cube[205] = cube_tmp[25];
        cube[206] = cube_tmp[26];
        cube[211] = cube_tmp[31];
        cube[212] = cube_tmp[32];
        break;

    case threeLw:
        cube[1] = cube_tmp[180];
        cube[2] = cube_tmp[179];
        cube[3] = cube_tmp[178];
        cube[7] = cube_tmp[174];
        cube[8] = cube_tmp[173];
        cube[9] = cube_tmp[172];
        cube[13] = cube_tmp[168];
        cube[14] = cube_tmp[167];
        cube[15] = cube_tmp[166];
        cube[19] = cube_tmp[162];
        cube[20] = cube_tmp[161];
        cube[21] = cube_tmp[160];
        cube[25] = cube_tmp[156];
        cube[26] = cube_tmp[155];
        cube[27] = cube_tmp[154];
        cube[31] = cube_tmp[150];
        cube[32] = cube_tmp[149];
        cube[33] = cube_tmp[148];
        cube[37] = cube_tmp[67];
        cube[38] = cube_tmp[61];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[49];
        cube[41] = cube_tmp[43];
        cube[42] = cube_tmp[37];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[62];
        cube[45] = cube_tmp[56];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[44];
        cube[48] = cube_tmp[38];
        cube[49] = cube_tmp[69];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[57];
        cube[52] = cube_tmp[51];
        cube[53] = cube_tmp[45];
        cube[54] = cube_tmp[39];
        cube[55] = cube_tmp[70];
        cube[56] = cube_tmp[64];
        cube[57] = cube_tmp[58];
        cube[58] = cube_tmp[52];
        cube[59] = cube_tmp[46];
        cube[60] = cube_tmp[40];
        cube[61] = cube_tmp[71];
        cube[62] = cube_tmp[65];
        cube[63] = cube_tmp[59];
        cube[64] = cube_tmp[53];
        cube[65] = cube_tmp[47];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[72];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[60];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[48];
        cube[72] = cube_tmp[42];
        cube[73] = cube_tmp[1];
        cube[74] = cube_tmp[2];
        cube[75] = cube_tmp[3];
        cube[79] = cube_tmp[7];
        cube[80] = cube_tmp[8];
        cube[81] = cube_tmp[9];
        cube[85] = cube_tmp[13];
        cube[86] = cube_tmp[14];
        cube[87] = cube_tmp[15];
        cube[91] = cube_tmp[19];
        cube[92] = cube_tmp[20];
        cube[93] = cube_tmp[21];
        cube[97] = cube_tmp[25];
        cube[98] = cube_tmp[26];
        cube[99] = cube_tmp[27];
        cube[103] = cube_tmp[31];
        cube[104] = cube_tmp[32];
        cube[105] = cube_tmp[33];
        cube[148] = cube_tmp[213];
        cube[149] = cube_tmp[212];
        cube[150] = cube_tmp[211];
        cube[154] = cube_tmp[207];
        cube[155] = cube_tmp[206];
        cube[156] = cube_tmp[205];
        cube[160] = cube_tmp[201];
        cube[161] = cube_tmp[200];
        cube[162] = cube_tmp[199];
        cube[166] = cube_tmp[195];
        cube[167] = cube_tmp[194];
        cube[168] = cube_tmp[193];
        cube[172] = cube_tmp[189];
        cube[173] = cube_tmp[188];
        cube[174] = cube_tmp[187];
        cube[178] = cube_tmp[183];
        cube[179] = cube_tmp[182];
        cube[180] = cube_tmp[181];
        cube[181] = cube_tmp[73];
        cube[182] = cube_tmp[74];
        cube[183] = cube_tmp[75];
        cube[187] = cube_tmp[79];
        cube[188] = cube_tmp[80];
        cube[189] = cube_tmp[81];
        cube[193] = cube_tmp[85];
        cube[194] = cube_tmp[86];
        cube[195] = cube_tmp[87];
        cube[199] = cube_tmp[91];
        cube[200] = cube_tmp[92];
        cube[201] = cube_tmp[93];
        cube[205] = cube_tmp[97];
        cube[206] = cube_tmp[98];
        cube[207] = cube_tmp[99];
        cube[211] = cube_tmp[103];
        cube[212] = cube_tmp[104];
        cube[213] = cube_tmp[105];
        break;

    case threeLw_PRIME:
        cube[1] = cube_tmp[73];
        cube[2] = cube_tmp[74];
        cube[3] = cube_tmp[75];
        cube[7] = cube_tmp[79];
        cube[8] = cube_tmp[80];
        cube[9] = cube_tmp[81];
        cube[13] = cube_tmp[85];
        cube[14] = cube_tmp[86];
        cube[15] = cube_tmp[87];
        cube[19] = cube_tmp[91];
        cube[20] = cube_tmp[92];
        cube[21] = cube_tmp[93];
        cube[25] = cube_tmp[97];
        cube[26] = cube_tmp[98];
        cube[27] = cube_tmp[99];
        cube[31] = cube_tmp[103];
        cube[32] = cube_tmp[104];
        cube[33] = cube_tmp[105];
        cube[37] = cube_tmp[42];
        cube[38] = cube_tmp[48];
        cube[39] = cube_tmp[54];
        cube[40] = cube_tmp[60];
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[72];
        cube[43] = cube_tmp[41];
        cube[44] = cube_tmp[47];
        cube[45] = cube_tmp[53];
        cube[46] = cube_tmp[59];
        cube[47] = cube_tmp[65];
        cube[48] = cube_tmp[71];
        cube[49] = cube_tmp[40];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[52];
        cube[52] = cube_tmp[58];
        cube[53] = cube_tmp[64];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[45];
        cube[57] = cube_tmp[51];
        cube[58] = cube_tmp[57];
        cube[59] = cube_tmp[63];
        cube[60] = cube_tmp[69];
        cube[61] = cube_tmp[38];
        cube[62] = cube_tmp[44];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[56];
        cube[65] = cube_tmp[62];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[37];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[49];
        cube[70] = cube_tmp[55];
        cube[71] = cube_tmp[61];
        cube[72] = cube_tmp[67];
        cube[73] = cube_tmp[181];
        cube[74] = cube_tmp[182];
        cube[75] = cube_tmp[183];
        cube[79] = cube_tmp[187];
        cube[80] = cube_tmp[188];
        cube[81] = cube_tmp[189];
        cube[85] = cube_tmp[193];
        cube[86] = cube_tmp[194];
        cube[87] = cube_tmp[195];
        cube[91] = cube_tmp[199];
        cube[92] = cube_tmp[200];
        cube[93] = cube_tmp[201];
        cube[97] = cube_tmp[205];
        cube[98] = cube_tmp[206];
        cube[99] = cube_tmp[207];
        cube[103] = cube_tmp[211];
        cube[104] = cube_tmp[212];
        cube[105] = cube_tmp[213];
        cube[148] = cube_tmp[33];
        cube[149] = cube_tmp[32];
        cube[150] = cube_tmp[31];
        cube[154] = cube_tmp[27];
        cube[155] = cube_tmp[26];
        cube[156] = cube_tmp[25];
        cube[160] = cube_tmp[21];
        cube[161] = cube_tmp[20];
        cube[162] = cube_tmp[19];
        cube[166] = cube_tmp[15];
        cube[167] = cube_tmp[14];
        cube[168] = cube_tmp[13];
        cube[172] = cube_tmp[9];
        cube[173] = cube_tmp[8];
        cube[174] = cube_tmp[7];
        cube[178] = cube_tmp[3];
        cube[179] = cube_tmp[2];
        cube[180] = cube_tmp[1];
        cube[181] = cube_tmp[180];
        cube[182] = cube_tmp[179];
        cube[183] = cube_tmp[178];
        cube[187] = cube_tmp[174];
        cube[188] = cube_tmp[173];
        cube[189] = cube_tmp[172];
        cube[193] = cube_tmp[168];
        cube[194] = cube_tmp[167];
        cube[195] = cube_tmp[166];
        cube[199] = cube_tmp[162];
        cube[200] = cube_tmp[161];
        cube[201] = cube_tmp[160];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[155];
        cube[207] = cube_tmp[154];
        cube[211] = cube_tmp[150];
        cube[212] = cube_tmp[149];
        cube[213] = cube_tmp[148];
        break;

    case threeLw2:
        cube[1] = cube_tmp[181];
        cube[2] = cube_tmp[182];
        cube[3] = cube_tmp[183];
        cube[7] = cube_tmp[187];
        cube[8] = cube_tmp[188];
        cube[9] = cube_tmp[189];
        cube[13] = cube_tmp[193];
        cube[14] = cube_tmp[194];
        cube[15] = cube_tmp[195];
        cube[19] = cube_tmp[199];
        cube[20] = cube_tmp[200];
        cube[21] = cube_tmp[201];
        cube[25] = cube_tmp[205];
        cube[26] = cube_tmp[206];
        cube[27] = cube_tmp[207];
        cube[31] = cube_tmp[211];
        cube[32] = cube_tmp[212];
        cube[33] = cube_tmp[213];
        cube[37] = cube_tmp[72];
        cube[38] = cube_tmp[71];
        cube[39] = cube_tmp[70];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[68];
        cube[42] = cube_tmp[67];
        cube[43] = cube_tmp[66];
        cube[44] = cube_tmp[65];
        cube[45] = cube_tmp[64];
        cube[46] = cube_tmp[63];
        cube[47] = cube_tmp[62];
        cube[48] = cube_tmp[61];
        cube[49] = cube_tmp[60];
        cube[50] = cube_tmp[59];
        cube[51] = cube_tmp[58];
        cube[52] = cube_tmp[57];
        cube[53] = cube_tmp[56];
        cube[54] = cube_tmp[55];
        cube[55] = cube_tmp[54];
        cube[56] = cube_tmp[53];
        cube[57] = cube_tmp[52];
        cube[58] = cube_tmp[51];
        cube[59] = cube_tmp[50];
        cube[60] = cube_tmp[49];
        cube[61] = cube_tmp[48];
        cube[62] = cube_tmp[47];
        cube[63] = cube_tmp[46];
        cube[64] = cube_tmp[45];
        cube[65] = cube_tmp[44];
        cube[66] = cube_tmp[43];
        cube[67] = cube_tmp[42];
        cube[68] = cube_tmp[41];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[39];
        cube[71] = cube_tmp[38];
        cube[72] = cube_tmp[37];
        cube[73] = cube_tmp[180];
        cube[74] = cube_tmp[179];
        cube[75] = cube_tmp[178];
        cube[79] = cube_tmp[174];
        cube[80] = cube_tmp[173];
        cube[81] = cube_tmp[172];
        cube[85] = cube_tmp[168];
        cube[86] = cube_tmp[167];
        cube[87] = cube_tmp[166];
        cube[91] = cube_tmp[162];
        cube[92] = cube_tmp[161];
        cube[93] = cube_tmp[160];
        cube[97] = cube_tmp[156];
        cube[98] = cube_tmp[155];
        cube[99] = cube_tmp[154];
        cube[103] = cube_tmp[150];
        cube[104] = cube_tmp[149];
        cube[105] = cube_tmp[148];
        cube[148] = cube_tmp[105];
        cube[149] = cube_tmp[104];
        cube[150] = cube_tmp[103];
        cube[154] = cube_tmp[99];
        cube[155] = cube_tmp[98];
        cube[156] = cube_tmp[97];
        cube[160] = cube_tmp[93];
        cube[161] = cube_tmp[92];
        cube[162] = cube_tmp[91];
        cube[166] = cube_tmp[87];
        cube[167] = cube_tmp[86];
        cube[168] = cube_tmp[85];
        cube[172] = cube_tmp[81];
        cube[173] = cube_tmp[80];
        cube[174] = cube_tmp[79];
        cube[178] = cube_tmp[75];
        cube[179] = cube_tmp[74];
        cube[180] = cube_tmp[73];
        cube[181] = cube_tmp[1];
        cube[182] = cube_tmp[2];
        cube[183] = cube_tmp[3];
        cube[187] = cube_tmp[7];
        cube[188] = cube_tmp[8];
        cube[189] = cube_tmp[9];
        cube[193] = cube_tmp[13];
        cube[194] = cube_tmp[14];
        cube[195] = cube_tmp[15];
        cube[199] = cube_tmp[19];
        cube[200] = cube_tmp[20];
        cube[201] = cube_tmp[21];
        cube[205] = cube_tmp[25];
        cube[206] = cube_tmp[26];
        cube[207] = cube_tmp[27];
        cube[211] = cube_tmp[31];
        cube[212] = cube_tmp[32];
        cube[213] = cube_tmp[33];
        break;

    case F:
        cube[31] = cube_tmp[72];
        cube[32] = cube_tmp[66];
        cube[33] = cube_tmp[60];
        cube[34] = cube_tmp[54];
        cube[35] = cube_tmp[48];
        cube[36] = cube_tmp[42];
        cube[42] = cube_tmp[181];
        cube[48] = cube_tmp[182];
        cube[54] = cube_tmp[183];
        cube[60] = cube_tmp[184];
        cube[66] = cube_tmp[185];
        cube[72] = cube_tmp[186];
        cube[73] = cube_tmp[103];
        cube[74] = cube_tmp[97];
        cube[75] = cube_tmp[91];
        cube[76] = cube_tmp[85];
        cube[77] = cube_tmp[79];
        cube[78] = cube_tmp[73];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[98];
        cube[81] = cube_tmp[92];
        cube[82] = cube_tmp[86];
        cube[83] = cube_tmp[80];
        cube[84] = cube_tmp[74];
        cube[85] = cube_tmp[105];
        cube[86] = cube_tmp[99];
        cube[87] = cube_tmp[93];
        cube[88] = cube_tmp[87];
        cube[89] = cube_tmp[81];
        cube[90] = cube_tmp[75];
        cube[91] = cube_tmp[106];
        cube[92] = cube_tmp[100];
        cube[93] = cube_tmp[94];
        cube[94] = cube_tmp[88];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[107];
        cube[98] = cube_tmp[101];
        cube[99] = cube_tmp[95];
        cube[100] = cube_tmp[89];
        cube[101] = cube_tmp[83];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[108];
        cube[104] = cube_tmp[102];
        cube[105] = cube_tmp[96];
        cube[106] = cube_tmp[90];
        cube[107] = cube_tmp[84];
        cube[108] = cube_tmp[78];
        cube[109] = cube_tmp[31];
        cube[115] = cube_tmp[32];
        cube[121] = cube_tmp[33];
        cube[127] = cube_tmp[34];
        cube[133] = cube_tmp[35];
        cube[139] = cube_tmp[36];
        cube[181] = cube_tmp[139];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[127];
        cube[184] = cube_tmp[121];
        cube[185] = cube_tmp[115];
        cube[186] = cube_tmp[109];
        break;

    case F_PRIME:
        cube[31] = cube_tmp[109];
        cube[32] = cube_tmp[115];
        cube[33] = cube_tmp[121];
        cube[34] = cube_tmp[127];
        cube[35] = cube_tmp[133];
        cube[36] = cube_tmp[139];
        cube[42] = cube_tmp[36];
        cube[48] = cube_tmp[35];
        cube[54] = cube_tmp[34];
        cube[60] = cube_tmp[33];
        cube[66] = cube_tmp[32];
        cube[72] = cube_tmp[31];
        cube[73] = cube_tmp[78];
        cube[74] = cube_tmp[84];
        cube[75] = cube_tmp[90];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[108];
        cube[79] = cube_tmp[77];
        cube[80] = cube_tmp[83];
        cube[81] = cube_tmp[89];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[101];
        cube[84] = cube_tmp[107];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[82];
        cube[87] = cube_tmp[88];
        cube[88] = cube_tmp[94];
        cube[89] = cube_tmp[100];
        cube[90] = cube_tmp[106];
        cube[91] = cube_tmp[75];
        cube[92] = cube_tmp[81];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[93];
        cube[95] = cube_tmp[99];
        cube[96] = cube_tmp[105];
        cube[97] = cube_tmp[74];
        cube[98] = cube_tmp[80];
        cube[99] = cube_tmp[86];
        cube[100] = cube_tmp[92];
        cube[101] = cube_tmp[98];
        cube[102] = cube_tmp[104];
        cube[103] = cube_tmp[73];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[85];
        cube[106] = cube_tmp[91];
        cube[107] = cube_tmp[97];
        cube[108] = cube_tmp[103];
        cube[109] = cube_tmp[186];
        cube[115] = cube_tmp[185];
        cube[121] = cube_tmp[184];
        cube[127] = cube_tmp[183];
        cube[133] = cube_tmp[182];
        cube[139] = cube_tmp[181];
        cube[181] = cube_tmp[42];
        cube[182] = cube_tmp[48];
        cube[183] = cube_tmp[54];
        cube[184] = cube_tmp[60];
        cube[185] = cube_tmp[66];
        cube[186] = cube_tmp[72];
        break;

    case F2:
        cube[31] = cube_tmp[186];
        cube[32] = cube_tmp[185];
        cube[33] = cube_tmp[184];
        cube[34] = cube_tmp[183];
        cube[35] = cube_tmp[182];
        cube[36] = cube_tmp[181];
        cube[42] = cube_tmp[139];
        cube[48] = cube_tmp[133];
        cube[54] = cube_tmp[127];
        cube[60] = cube_tmp[121];
        cube[66] = cube_tmp[115];
        cube[72] = cube_tmp[109];
        cube[73] = cube_tmp[108];
        cube[74] = cube_tmp[107];
        cube[75] = cube_tmp[106];
        cube[76] = cube_tmp[105];
        cube[77] = cube_tmp[104];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[102];
        cube[80] = cube_tmp[101];
        cube[81] = cube_tmp[100];
        cube[82] = cube_tmp[99];
        cube[83] = cube_tmp[98];
        cube[84] = cube_tmp[97];
        cube[85] = cube_tmp[96];
        cube[86] = cube_tmp[95];
        cube[87] = cube_tmp[94];
        cube[88] = cube_tmp[93];
        cube[89] = cube_tmp[92];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[89];
        cube[93] = cube_tmp[88];
        cube[94] = cube_tmp[87];
        cube[95] = cube_tmp[86];
        cube[96] = cube_tmp[85];
        cube[97] = cube_tmp[84];
        cube[98] = cube_tmp[83];
        cube[99] = cube_tmp[82];
        cube[100] = cube_tmp[81];
        cube[101] = cube_tmp[80];
        cube[102] = cube_tmp[79];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[77];
        cube[105] = cube_tmp[76];
        cube[106] = cube_tmp[75];
        cube[107] = cube_tmp[74];
        cube[108] = cube_tmp[73];
        cube[109] = cube_tmp[72];
        cube[115] = cube_tmp[66];
        cube[121] = cube_tmp[60];
        cube[127] = cube_tmp[54];
        cube[133] = cube_tmp[48];
        cube[139] = cube_tmp[42];
        cube[181] = cube_tmp[36];
        cube[182] = cube_tmp[35];
        cube[183] = cube_tmp[34];
        cube[184] = cube_tmp[33];
        cube[185] = cube_tmp[32];
        cube[186] = cube_tmp[31];
        break;

    case Fw:
        cube[25] = cube_tmp[71];
        cube[26] = cube_tmp[65];
        cube[27] = cube_tmp[59];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[41];
        cube[31] = cube_tmp[72];
        cube[32] = cube_tmp[66];
        cube[33] = cube_tmp[60];
        cube[34] = cube_tmp[54];
        cube[35] = cube_tmp[48];
        cube[36] = cube_tmp[42];
        cube[41] = cube_tmp[187];
        cube[42] = cube_tmp[181];
        cube[47] = cube_tmp[188];
        cube[48] = cube_tmp[182];
        cube[53] = cube_tmp[189];
        cube[54] = cube_tmp[183];
        cube[59] = cube_tmp[190];
        cube[60] = cube_tmp[184];
        cube[65] = cube_tmp[191];
        cube[66] = cube_tmp[185];
        cube[71] = cube_tmp[192];
        cube[72] = cube_tmp[186];
        cube[73] = cube_tmp[103];
        cube[74] = cube_tmp[97];
        cube[75] = cube_tmp[91];
        cube[76] = cube_tmp[85];
        cube[77] = cube_tmp[79];
        cube[78] = cube_tmp[73];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[98];
        cube[81] = cube_tmp[92];
        cube[82] = cube_tmp[86];
        cube[83] = cube_tmp[80];
        cube[84] = cube_tmp[74];
        cube[85] = cube_tmp[105];
        cube[86] = cube_tmp[99];
        cube[87] = cube_tmp[93];
        cube[88] = cube_tmp[87];
        cube[89] = cube_tmp[81];
        cube[90] = cube_tmp[75];
        cube[91] = cube_tmp[106];
        cube[92] = cube_tmp[100];
        cube[93] = cube_tmp[94];
        cube[94] = cube_tmp[88];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[107];
        cube[98] = cube_tmp[101];
        cube[99] = cube_tmp[95];
        cube[100] = cube_tmp[89];
        cube[101] = cube_tmp[83];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[108];
        cube[104] = cube_tmp[102];
        cube[105] = cube_tmp[96];
        cube[106] = cube_tmp[90];
        cube[107] = cube_tmp[84];
        cube[108] = cube_tmp[78];
        cube[109] = cube_tmp[31];
        cube[110] = cube_tmp[25];
        cube[115] = cube_tmp[32];
        cube[116] = cube_tmp[26];
        cube[121] = cube_tmp[33];
        cube[122] = cube_tmp[27];
        cube[127] = cube_tmp[34];
        cube[128] = cube_tmp[28];
        cube[133] = cube_tmp[35];
        cube[134] = cube_tmp[29];
        cube[139] = cube_tmp[36];
        cube[140] = cube_tmp[30];
        cube[181] = cube_tmp[139];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[127];
        cube[184] = cube_tmp[121];
        cube[185] = cube_tmp[115];
        cube[186] = cube_tmp[109];
        cube[187] = cube_tmp[140];
        cube[188] = cube_tmp[134];
        cube[189] = cube_tmp[128];
        cube[190] = cube_tmp[122];
        cube[191] = cube_tmp[116];
        cube[192] = cube_tmp[110];
        break;

    case Fw_PRIME:
        cube[25] = cube_tmp[110];
        cube[26] = cube_tmp[116];
        cube[27] = cube_tmp[122];
        cube[28] = cube_tmp[128];
        cube[29] = cube_tmp[134];
        cube[30] = cube_tmp[140];
        cube[31] = cube_tmp[109];
        cube[32] = cube_tmp[115];
        cube[33] = cube_tmp[121];
        cube[34] = cube_tmp[127];
        cube[35] = cube_tmp[133];
        cube[36] = cube_tmp[139];
        cube[41] = cube_tmp[30];
        cube[42] = cube_tmp[36];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[35];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[34];
        cube[59] = cube_tmp[27];
        cube[60] = cube_tmp[33];
        cube[65] = cube_tmp[26];
        cube[66] = cube_tmp[32];
        cube[71] = cube_tmp[25];
        cube[72] = cube_tmp[31];
        cube[73] = cube_tmp[78];
        cube[74] = cube_tmp[84];
        cube[75] = cube_tmp[90];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[108];
        cube[79] = cube_tmp[77];
        cube[80] = cube_tmp[83];
        cube[81] = cube_tmp[89];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[101];
        cube[84] = cube_tmp[107];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[82];
        cube[87] = cube_tmp[88];
        cube[88] = cube_tmp[94];
        cube[89] = cube_tmp[100];
        cube[90] = cube_tmp[106];
        cube[91] = cube_tmp[75];
        cube[92] = cube_tmp[81];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[93];
        cube[95] = cube_tmp[99];
        cube[96] = cube_tmp[105];
        cube[97] = cube_tmp[74];
        cube[98] = cube_tmp[80];
        cube[99] = cube_tmp[86];
        cube[100] = cube_tmp[92];
        cube[101] = cube_tmp[98];
        cube[102] = cube_tmp[104];
        cube[103] = cube_tmp[73];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[85];
        cube[106] = cube_tmp[91];
        cube[107] = cube_tmp[97];
        cube[108] = cube_tmp[103];
        cube[109] = cube_tmp[186];
        cube[110] = cube_tmp[192];
        cube[115] = cube_tmp[185];
        cube[116] = cube_tmp[191];
        cube[121] = cube_tmp[184];
        cube[122] = cube_tmp[190];
        cube[127] = cube_tmp[183];
        cube[128] = cube_tmp[189];
        cube[133] = cube_tmp[182];
        cube[134] = cube_tmp[188];
        cube[139] = cube_tmp[181];
        cube[140] = cube_tmp[187];
        cube[181] = cube_tmp[42];
        cube[182] = cube_tmp[48];
        cube[183] = cube_tmp[54];
        cube[184] = cube_tmp[60];
        cube[185] = cube_tmp[66];
        cube[186] = cube_tmp[72];
        cube[187] = cube_tmp[41];
        cube[188] = cube_tmp[47];
        cube[189] = cube_tmp[53];
        cube[190] = cube_tmp[59];
        cube[191] = cube_tmp[65];
        cube[192] = cube_tmp[71];
        break;

    case Fw2:
        cube[25] = cube_tmp[192];
        cube[26] = cube_tmp[191];
        cube[27] = cube_tmp[190];
        cube[28] = cube_tmp[189];
        cube[29] = cube_tmp[188];
        cube[30] = cube_tmp[187];
        cube[31] = cube_tmp[186];
        cube[32] = cube_tmp[185];
        cube[33] = cube_tmp[184];
        cube[34] = cube_tmp[183];
        cube[35] = cube_tmp[182];
        cube[36] = cube_tmp[181];
        cube[41] = cube_tmp[140];
        cube[42] = cube_tmp[139];
        cube[47] = cube_tmp[134];
        cube[48] = cube_tmp[133];
        cube[53] = cube_tmp[128];
        cube[54] = cube_tmp[127];
        cube[59] = cube_tmp[122];
        cube[60] = cube_tmp[121];
        cube[65] = cube_tmp[116];
        cube[66] = cube_tmp[115];
        cube[71] = cube_tmp[110];
        cube[72] = cube_tmp[109];
        cube[73] = cube_tmp[108];
        cube[74] = cube_tmp[107];
        cube[75] = cube_tmp[106];
        cube[76] = cube_tmp[105];
        cube[77] = cube_tmp[104];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[102];
        cube[80] = cube_tmp[101];
        cube[81] = cube_tmp[100];
        cube[82] = cube_tmp[99];
        cube[83] = cube_tmp[98];
        cube[84] = cube_tmp[97];
        cube[85] = cube_tmp[96];
        cube[86] = cube_tmp[95];
        cube[87] = cube_tmp[94];
        cube[88] = cube_tmp[93];
        cube[89] = cube_tmp[92];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[89];
        cube[93] = cube_tmp[88];
        cube[94] = cube_tmp[87];
        cube[95] = cube_tmp[86];
        cube[96] = cube_tmp[85];
        cube[97] = cube_tmp[84];
        cube[98] = cube_tmp[83];
        cube[99] = cube_tmp[82];
        cube[100] = cube_tmp[81];
        cube[101] = cube_tmp[80];
        cube[102] = cube_tmp[79];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[77];
        cube[105] = cube_tmp[76];
        cube[106] = cube_tmp[75];
        cube[107] = cube_tmp[74];
        cube[108] = cube_tmp[73];
        cube[109] = cube_tmp[72];
        cube[110] = cube_tmp[71];
        cube[115] = cube_tmp[66];
        cube[116] = cube_tmp[65];
        cube[121] = cube_tmp[60];
        cube[122] = cube_tmp[59];
        cube[127] = cube_tmp[54];
        cube[128] = cube_tmp[53];
        cube[133] = cube_tmp[48];
        cube[134] = cube_tmp[47];
        cube[139] = cube_tmp[42];
        cube[140] = cube_tmp[41];
        cube[181] = cube_tmp[36];
        cube[182] = cube_tmp[35];
        cube[183] = cube_tmp[34];
        cube[184] = cube_tmp[33];
        cube[185] = cube_tmp[32];
        cube[186] = cube_tmp[31];
        cube[187] = cube_tmp[30];
        cube[188] = cube_tmp[29];
        cube[189] = cube_tmp[28];
        cube[190] = cube_tmp[27];
        cube[191] = cube_tmp[26];
        cube[192] = cube_tmp[25];
        break;

    case threeFw:
        cube[19] = cube_tmp[70];
        cube[20] = cube_tmp[64];
        cube[21] = cube_tmp[58];
        cube[22] = cube_tmp[52];
        cube[23] = cube_tmp[46];
        cube[24] = cube_tmp[40];
        cube[25] = cube_tmp[71];
        cube[26] = cube_tmp[65];
        cube[27] = cube_tmp[59];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[41];
        cube[31] = cube_tmp[72];
        cube[32] = cube_tmp[66];
        cube[33] = cube_tmp[60];
        cube[34] = cube_tmp[54];
        cube[35] = cube_tmp[48];
        cube[36] = cube_tmp[42];
        cube[40] = cube_tmp[193];
        cube[41] = cube_tmp[187];
        cube[42] = cube_tmp[181];
        cube[46] = cube_tmp[194];
        cube[47] = cube_tmp[188];
        cube[48] = cube_tmp[182];
        cube[52] = cube_tmp[195];
        cube[53] = cube_tmp[189];
        cube[54] = cube_tmp[183];
        cube[58] = cube_tmp[196];
        cube[59] = cube_tmp[190];
        cube[60] = cube_tmp[184];
        cube[64] = cube_tmp[197];
        cube[65] = cube_tmp[191];
        cube[66] = cube_tmp[185];
        cube[70] = cube_tmp[198];
        cube[71] = cube_tmp[192];
        cube[72] = cube_tmp[186];
        cube[73] = cube_tmp[103];
        cube[74] = cube_tmp[97];
        cube[75] = cube_tmp[91];
        cube[76] = cube_tmp[85];
        cube[77] = cube_tmp[79];
        cube[78] = cube_tmp[73];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[98];
        cube[81] = cube_tmp[92];
        cube[82] = cube_tmp[86];
        cube[83] = cube_tmp[80];
        cube[84] = cube_tmp[74];
        cube[85] = cube_tmp[105];
        cube[86] = cube_tmp[99];
        cube[87] = cube_tmp[93];
        cube[88] = cube_tmp[87];
        cube[89] = cube_tmp[81];
        cube[90] = cube_tmp[75];
        cube[91] = cube_tmp[106];
        cube[92] = cube_tmp[100];
        cube[93] = cube_tmp[94];
        cube[94] = cube_tmp[88];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[107];
        cube[98] = cube_tmp[101];
        cube[99] = cube_tmp[95];
        cube[100] = cube_tmp[89];
        cube[101] = cube_tmp[83];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[108];
        cube[104] = cube_tmp[102];
        cube[105] = cube_tmp[96];
        cube[106] = cube_tmp[90];
        cube[107] = cube_tmp[84];
        cube[108] = cube_tmp[78];
        cube[109] = cube_tmp[31];
        cube[110] = cube_tmp[25];
        cube[111] = cube_tmp[19];
        cube[115] = cube_tmp[32];
        cube[116] = cube_tmp[26];
        cube[117] = cube_tmp[20];
        cube[121] = cube_tmp[33];
        cube[122] = cube_tmp[27];
        cube[123] = cube_tmp[21];
        cube[127] = cube_tmp[34];
        cube[128] = cube_tmp[28];
        cube[129] = cube_tmp[22];
        cube[133] = cube_tmp[35];
        cube[134] = cube_tmp[29];
        cube[135] = cube_tmp[23];
        cube[139] = cube_tmp[36];
        cube[140] = cube_tmp[30];
        cube[141] = cube_tmp[24];
        cube[181] = cube_tmp[139];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[127];
        cube[184] = cube_tmp[121];
        cube[185] = cube_tmp[115];
        cube[186] = cube_tmp[109];
        cube[187] = cube_tmp[140];
        cube[188] = cube_tmp[134];
        cube[189] = cube_tmp[128];
        cube[190] = cube_tmp[122];
        cube[191] = cube_tmp[116];
        cube[192] = cube_tmp[110];
        cube[193] = cube_tmp[141];
        cube[194] = cube_tmp[135];
        cube[195] = cube_tmp[129];
        cube[196] = cube_tmp[123];
        cube[197] = cube_tmp[117];
        cube[198] = cube_tmp[111];
        break;

    case threeFw_PRIME:
        cube[19] = cube_tmp[111];
        cube[20] = cube_tmp[117];
        cube[21] = cube_tmp[123];
        cube[22] = cube_tmp[129];
        cube[23] = cube_tmp[135];
        cube[24] = cube_tmp[141];
        cube[25] = cube_tmp[110];
        cube[26] = cube_tmp[116];
        cube[27] = cube_tmp[122];
        cube[28] = cube_tmp[128];
        cube[29] = cube_tmp[134];
        cube[30] = cube_tmp[140];
        cube[31] = cube_tmp[109];
        cube[32] = cube_tmp[115];
        cube[33] = cube_tmp[121];
        cube[34] = cube_tmp[127];
        cube[35] = cube_tmp[133];
        cube[36] = cube_tmp[139];
        cube[40] = cube_tmp[24];
        cube[41] = cube_tmp[30];
        cube[42] = cube_tmp[36];
        cube[46] = cube_tmp[23];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[35];
        cube[52] = cube_tmp[22];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[34];
        cube[58] = cube_tmp[21];
        cube[59] = cube_tmp[27];
        cube[60] = cube_tmp[33];
        cube[64] = cube_tmp[20];
        cube[65] = cube_tmp[26];
        cube[66] = cube_tmp[32];
        cube[70] = cube_tmp[19];
        cube[71] = cube_tmp[25];
        cube[72] = cube_tmp[31];
        cube[73] = cube_tmp[78];
        cube[74] = cube_tmp[84];
        cube[75] = cube_tmp[90];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[108];
        cube[79] = cube_tmp[77];
        cube[80] = cube_tmp[83];
        cube[81] = cube_tmp[89];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[101];
        cube[84] = cube_tmp[107];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[82];
        cube[87] = cube_tmp[88];
        cube[88] = cube_tmp[94];
        cube[89] = cube_tmp[100];
        cube[90] = cube_tmp[106];
        cube[91] = cube_tmp[75];
        cube[92] = cube_tmp[81];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[93];
        cube[95] = cube_tmp[99];
        cube[96] = cube_tmp[105];
        cube[97] = cube_tmp[74];
        cube[98] = cube_tmp[80];
        cube[99] = cube_tmp[86];
        cube[100] = cube_tmp[92];
        cube[101] = cube_tmp[98];
        cube[102] = cube_tmp[104];
        cube[103] = cube_tmp[73];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[85];
        cube[106] = cube_tmp[91];
        cube[107] = cube_tmp[97];
        cube[108] = cube_tmp[103];
        cube[109] = cube_tmp[186];
        cube[110] = cube_tmp[192];
        cube[111] = cube_tmp[198];
        cube[115] = cube_tmp[185];
        cube[116] = cube_tmp[191];
        cube[117] = cube_tmp[197];
        cube[121] = cube_tmp[184];
        cube[122] = cube_tmp[190];
        cube[123] = cube_tmp[196];
        cube[127] = cube_tmp[183];
        cube[128] = cube_tmp[189];
        cube[129] = cube_tmp[195];
        cube[133] = cube_tmp[182];
        cube[134] = cube_tmp[188];
        cube[135] = cube_tmp[194];
        cube[139] = cube_tmp[181];
        cube[140] = cube_tmp[187];
        cube[141] = cube_tmp[193];
        cube[181] = cube_tmp[42];
        cube[182] = cube_tmp[48];
        cube[183] = cube_tmp[54];
        cube[184] = cube_tmp[60];
        cube[185] = cube_tmp[66];
        cube[186] = cube_tmp[72];
        cube[187] = cube_tmp[41];
        cube[188] = cube_tmp[47];
        cube[189] = cube_tmp[53];
        cube[190] = cube_tmp[59];
        cube[191] = cube_tmp[65];
        cube[192] = cube_tmp[71];
        cube[193] = cube_tmp[40];
        cube[194] = cube_tmp[46];
        cube[195] = cube_tmp[52];
        cube[196] = cube_tmp[58];
        cube[197] = cube_tmp[64];
        cube[198] = cube_tmp[70];
        break;

    case threeFw2:
        cube[19] = cube_tmp[198];
        cube[20] = cube_tmp[197];
        cube[21] = cube_tmp[196];
        cube[22] = cube_tmp[195];
        cube[23] = cube_tmp[194];
        cube[24] = cube_tmp[193];
        cube[25] = cube_tmp[192];
        cube[26] = cube_tmp[191];
        cube[27] = cube_tmp[190];
        cube[28] = cube_tmp[189];
        cube[29] = cube_tmp[188];
        cube[30] = cube_tmp[187];
        cube[31] = cube_tmp[186];
        cube[32] = cube_tmp[185];
        cube[33] = cube_tmp[184];
        cube[34] = cube_tmp[183];
        cube[35] = cube_tmp[182];
        cube[36] = cube_tmp[181];
        cube[40] = cube_tmp[141];
        cube[41] = cube_tmp[140];
        cube[42] = cube_tmp[139];
        cube[46] = cube_tmp[135];
        cube[47] = cube_tmp[134];
        cube[48] = cube_tmp[133];
        cube[52] = cube_tmp[129];
        cube[53] = cube_tmp[128];
        cube[54] = cube_tmp[127];
        cube[58] = cube_tmp[123];
        cube[59] = cube_tmp[122];
        cube[60] = cube_tmp[121];
        cube[64] = cube_tmp[117];
        cube[65] = cube_tmp[116];
        cube[66] = cube_tmp[115];
        cube[70] = cube_tmp[111];
        cube[71] = cube_tmp[110];
        cube[72] = cube_tmp[109];
        cube[73] = cube_tmp[108];
        cube[74] = cube_tmp[107];
        cube[75] = cube_tmp[106];
        cube[76] = cube_tmp[105];
        cube[77] = cube_tmp[104];
        cube[78] = cube_tmp[103];
        cube[79] = cube_tmp[102];
        cube[80] = cube_tmp[101];
        cube[81] = cube_tmp[100];
        cube[82] = cube_tmp[99];
        cube[83] = cube_tmp[98];
        cube[84] = cube_tmp[97];
        cube[85] = cube_tmp[96];
        cube[86] = cube_tmp[95];
        cube[87] = cube_tmp[94];
        cube[88] = cube_tmp[93];
        cube[89] = cube_tmp[92];
        cube[90] = cube_tmp[91];
        cube[91] = cube_tmp[90];
        cube[92] = cube_tmp[89];
        cube[93] = cube_tmp[88];
        cube[94] = cube_tmp[87];
        cube[95] = cube_tmp[86];
        cube[96] = cube_tmp[85];
        cube[97] = cube_tmp[84];
        cube[98] = cube_tmp[83];
        cube[99] = cube_tmp[82];
        cube[100] = cube_tmp[81];
        cube[101] = cube_tmp[80];
        cube[102] = cube_tmp[79];
        cube[103] = cube_tmp[78];
        cube[104] = cube_tmp[77];
        cube[105] = cube_tmp[76];
        cube[106] = cube_tmp[75];
        cube[107] = cube_tmp[74];
        cube[108] = cube_tmp[73];
        cube[109] = cube_tmp[72];
        cube[110] = cube_tmp[71];
        cube[111] = cube_tmp[70];
        cube[115] = cube_tmp[66];
        cube[116] = cube_tmp[65];
        cube[117] = cube_tmp[64];
        cube[121] = cube_tmp[60];
        cube[122] = cube_tmp[59];
        cube[123] = cube_tmp[58];
        cube[127] = cube_tmp[54];
        cube[128] = cube_tmp[53];
        cube[129] = cube_tmp[52];
        cube[133] = cube_tmp[48];
        cube[134] = cube_tmp[47];
        cube[135] = cube_tmp[46];
        cube[139] = cube_tmp[42];
        cube[140] = cube_tmp[41];
        cube[141] = cube_tmp[40];
        cube[181] = cube_tmp[36];
        cube[182] = cube_tmp[35];
        cube[183] = cube_tmp[34];
        cube[184] = cube_tmp[33];
        cube[185] = cube_tmp[32];
        cube[186] = cube_tmp[31];
        cube[187] = cube_tmp[30];
        cube[188] = cube_tmp[29];
        cube[189] = cube_tmp[28];
        cube[190] = cube_tmp[27];
        cube[191] = cube_tmp[26];
        cube[192] = cube_tmp[25];
        cube[193] = cube_tmp[24];
        cube[194] = cube_tmp[23];
        cube[195] = cube_tmp[22];
        cube[196] = cube_tmp[21];
        cube[197] = cube_tmp[20];
        cube[198] = cube_tmp[19];
        break;

    case R:
        cube[6] = cube_tmp[78];
        cube[12] = cube_tmp[84];
        cube[18] = cube_tmp[90];
        cube[24] = cube_tmp[96];
        cube[30] = cube_tmp[102];
        cube[36] = cube_tmp[108];
        cube[78] = cube_tmp[186];
        cube[84] = cube_tmp[192];
        cube[90] = cube_tmp[198];
        cube[96] = cube_tmp[204];
        cube[102] = cube_tmp[210];
        cube[108] = cube_tmp[216];
        cube[109] = cube_tmp[139];
        cube[110] = cube_tmp[133];
        cube[111] = cube_tmp[127];
        cube[112] = cube_tmp[121];
        cube[113] = cube_tmp[115];
        cube[114] = cube_tmp[109];
        cube[115] = cube_tmp[140];
        cube[116] = cube_tmp[134];
        cube[117] = cube_tmp[128];
        cube[118] = cube_tmp[122];
        cube[119] = cube_tmp[116];
        cube[120] = cube_tmp[110];
        cube[121] = cube_tmp[141];
        cube[122] = cube_tmp[135];
        cube[123] = cube_tmp[129];
        cube[124] = cube_tmp[123];
        cube[125] = cube_tmp[117];
        cube[126] = cube_tmp[111];
        cube[127] = cube_tmp[142];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[130];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[118];
        cube[132] = cube_tmp[112];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[137];
        cube[135] = cube_tmp[131];
        cube[136] = cube_tmp[125];
        cube[137] = cube_tmp[119];
        cube[138] = cube_tmp[113];
        cube[139] = cube_tmp[144];
        cube[140] = cube_tmp[138];
        cube[141] = cube_tmp[132];
        cube[142] = cube_tmp[126];
        cube[143] = cube_tmp[120];
        cube[144] = cube_tmp[114];
        cube[145] = cube_tmp[36];
        cube[151] = cube_tmp[30];
        cube[157] = cube_tmp[24];
        cube[163] = cube_tmp[18];
        cube[169] = cube_tmp[12];
        cube[175] = cube_tmp[6];
        cube[186] = cube_tmp[175];
        cube[192] = cube_tmp[169];
        cube[198] = cube_tmp[163];
        cube[204] = cube_tmp[157];
        cube[210] = cube_tmp[151];
        cube[216] = cube_tmp[145];
        break;

    case R_PRIME:
        cube[6] = cube_tmp[175];
        cube[12] = cube_tmp[169];
        cube[18] = cube_tmp[163];
        cube[24] = cube_tmp[157];
        cube[30] = cube_tmp[151];
        cube[36] = cube_tmp[145];
        cube[78] = cube_tmp[6];
        cube[84] = cube_tmp[12];
        cube[90] = cube_tmp[18];
        cube[96] = cube_tmp[24];
        cube[102] = cube_tmp[30];
        cube[108] = cube_tmp[36];
        cube[109] = cube_tmp[114];
        cube[110] = cube_tmp[120];
        cube[111] = cube_tmp[126];
        cube[112] = cube_tmp[132];
        cube[113] = cube_tmp[138];
        cube[114] = cube_tmp[144];
        cube[115] = cube_tmp[113];
        cube[116] = cube_tmp[119];
        cube[117] = cube_tmp[125];
        cube[118] = cube_tmp[131];
        cube[119] = cube_tmp[137];
        cube[120] = cube_tmp[143];
        cube[121] = cube_tmp[112];
        cube[122] = cube_tmp[118];
        cube[123] = cube_tmp[124];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[136];
        cube[126] = cube_tmp[142];
        cube[127] = cube_tmp[111];
        cube[128] = cube_tmp[117];
        cube[129] = cube_tmp[123];
        cube[130] = cube_tmp[129];
        cube[131] = cube_tmp[135];
        cube[132] = cube_tmp[141];
        cube[133] = cube_tmp[110];
        cube[134] = cube_tmp[116];
        cube[135] = cube_tmp[122];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[134];
        cube[138] = cube_tmp[140];
        cube[139] = cube_tmp[109];
        cube[140] = cube_tmp[115];
        cube[141] = cube_tmp[121];
        cube[142] = cube_tmp[127];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[139];
        cube[145] = cube_tmp[216];
        cube[151] = cube_tmp[210];
        cube[157] = cube_tmp[204];
        cube[163] = cube_tmp[198];
        cube[169] = cube_tmp[192];
        cube[175] = cube_tmp[186];
        cube[186] = cube_tmp[78];
        cube[192] = cube_tmp[84];
        cube[198] = cube_tmp[90];
        cube[204] = cube_tmp[96];
        cube[210] = cube_tmp[102];
        cube[216] = cube_tmp[108];
        break;

    case R2:
        cube[6] = cube_tmp[186];
        cube[12] = cube_tmp[192];
        cube[18] = cube_tmp[198];
        cube[24] = cube_tmp[204];
        cube[30] = cube_tmp[210];
        cube[36] = cube_tmp[216];
        cube[78] = cube_tmp[175];
        cube[84] = cube_tmp[169];
        cube[90] = cube_tmp[163];
        cube[96] = cube_tmp[157];
        cube[102] = cube_tmp[151];
        cube[108] = cube_tmp[145];
        cube[109] = cube_tmp[144];
        cube[110] = cube_tmp[143];
        cube[111] = cube_tmp[142];
        cube[112] = cube_tmp[141];
        cube[113] = cube_tmp[140];
        cube[114] = cube_tmp[139];
        cube[115] = cube_tmp[138];
        cube[116] = cube_tmp[137];
        cube[117] = cube_tmp[136];
        cube[118] = cube_tmp[135];
        cube[119] = cube_tmp[134];
        cube[120] = cube_tmp[133];
        cube[121] = cube_tmp[132];
        cube[122] = cube_tmp[131];
        cube[123] = cube_tmp[130];
        cube[124] = cube_tmp[129];
        cube[125] = cube_tmp[128];
        cube[126] = cube_tmp[127];
        cube[127] = cube_tmp[126];
        cube[128] = cube_tmp[125];
        cube[129] = cube_tmp[124];
        cube[130] = cube_tmp[123];
        cube[131] = cube_tmp[122];
        cube[132] = cube_tmp[121];
        cube[133] = cube_tmp[120];
        cube[134] = cube_tmp[119];
        cube[135] = cube_tmp[118];
        cube[136] = cube_tmp[117];
        cube[137] = cube_tmp[116];
        cube[138] = cube_tmp[115];
        cube[139] = cube_tmp[114];
        cube[140] = cube_tmp[113];
        cube[141] = cube_tmp[112];
        cube[142] = cube_tmp[111];
        cube[143] = cube_tmp[110];
        cube[144] = cube_tmp[109];
        cube[145] = cube_tmp[108];
        cube[151] = cube_tmp[102];
        cube[157] = cube_tmp[96];
        cube[163] = cube_tmp[90];
        cube[169] = cube_tmp[84];
        cube[175] = cube_tmp[78];
        cube[186] = cube_tmp[6];
        cube[192] = cube_tmp[12];
        cube[198] = cube_tmp[18];
        cube[204] = cube_tmp[24];
        cube[210] = cube_tmp[30];
        cube[216] = cube_tmp[36];
        break;

    case Rw:
        cube[5] = cube_tmp[77];
        cube[6] = cube_tmp[78];
        cube[11] = cube_tmp[83];
        cube[12] = cube_tmp[84];
        cube[17] = cube_tmp[89];
        cube[18] = cube_tmp[90];
        cube[23] = cube_tmp[95];
        cube[24] = cube_tmp[96];
        cube[29] = cube_tmp[101];
        cube[30] = cube_tmp[102];
        cube[35] = cube_tmp[107];
        cube[36] = cube_tmp[108];
        cube[77] = cube_tmp[185];
        cube[78] = cube_tmp[186];
        cube[83] = cube_tmp[191];
        cube[84] = cube_tmp[192];
        cube[89] = cube_tmp[197];
        cube[90] = cube_tmp[198];
        cube[95] = cube_tmp[203];
        cube[96] = cube_tmp[204];
        cube[101] = cube_tmp[209];
        cube[102] = cube_tmp[210];
        cube[107] = cube_tmp[215];
        cube[108] = cube_tmp[216];
        cube[109] = cube_tmp[139];
        cube[110] = cube_tmp[133];
        cube[111] = cube_tmp[127];
        cube[112] = cube_tmp[121];
        cube[113] = cube_tmp[115];
        cube[114] = cube_tmp[109];
        cube[115] = cube_tmp[140];
        cube[116] = cube_tmp[134];
        cube[117] = cube_tmp[128];
        cube[118] = cube_tmp[122];
        cube[119] = cube_tmp[116];
        cube[120] = cube_tmp[110];
        cube[121] = cube_tmp[141];
        cube[122] = cube_tmp[135];
        cube[123] = cube_tmp[129];
        cube[124] = cube_tmp[123];
        cube[125] = cube_tmp[117];
        cube[126] = cube_tmp[111];
        cube[127] = cube_tmp[142];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[130];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[118];
        cube[132] = cube_tmp[112];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[137];
        cube[135] = cube_tmp[131];
        cube[136] = cube_tmp[125];
        cube[137] = cube_tmp[119];
        cube[138] = cube_tmp[113];
        cube[139] = cube_tmp[144];
        cube[140] = cube_tmp[138];
        cube[141] = cube_tmp[132];
        cube[142] = cube_tmp[126];
        cube[143] = cube_tmp[120];
        cube[144] = cube_tmp[114];
        cube[145] = cube_tmp[36];
        cube[146] = cube_tmp[35];
        cube[151] = cube_tmp[30];
        cube[152] = cube_tmp[29];
        cube[157] = cube_tmp[24];
        cube[158] = cube_tmp[23];
        cube[163] = cube_tmp[18];
        cube[164] = cube_tmp[17];
        cube[169] = cube_tmp[12];
        cube[170] = cube_tmp[11];
        cube[175] = cube_tmp[6];
        cube[176] = cube_tmp[5];
        cube[185] = cube_tmp[176];
        cube[186] = cube_tmp[175];
        cube[191] = cube_tmp[170];
        cube[192] = cube_tmp[169];
        cube[197] = cube_tmp[164];
        cube[198] = cube_tmp[163];
        cube[203] = cube_tmp[158];
        cube[204] = cube_tmp[157];
        cube[209] = cube_tmp[152];
        cube[210] = cube_tmp[151];
        cube[215] = cube_tmp[146];
        cube[216] = cube_tmp[145];
        break;

    case Rw_PRIME:
        cube[5] = cube_tmp[176];
        cube[6] = cube_tmp[175];
        cube[11] = cube_tmp[170];
        cube[12] = cube_tmp[169];
        cube[17] = cube_tmp[164];
        cube[18] = cube_tmp[163];
        cube[23] = cube_tmp[158];
        cube[24] = cube_tmp[157];
        cube[29] = cube_tmp[152];
        cube[30] = cube_tmp[151];
        cube[35] = cube_tmp[146];
        cube[36] = cube_tmp[145];
        cube[77] = cube_tmp[5];
        cube[78] = cube_tmp[6];
        cube[83] = cube_tmp[11];
        cube[84] = cube_tmp[12];
        cube[89] = cube_tmp[17];
        cube[90] = cube_tmp[18];
        cube[95] = cube_tmp[23];
        cube[96] = cube_tmp[24];
        cube[101] = cube_tmp[29];
        cube[102] = cube_tmp[30];
        cube[107] = cube_tmp[35];
        cube[108] = cube_tmp[36];
        cube[109] = cube_tmp[114];
        cube[110] = cube_tmp[120];
        cube[111] = cube_tmp[126];
        cube[112] = cube_tmp[132];
        cube[113] = cube_tmp[138];
        cube[114] = cube_tmp[144];
        cube[115] = cube_tmp[113];
        cube[116] = cube_tmp[119];
        cube[117] = cube_tmp[125];
        cube[118] = cube_tmp[131];
        cube[119] = cube_tmp[137];
        cube[120] = cube_tmp[143];
        cube[121] = cube_tmp[112];
        cube[122] = cube_tmp[118];
        cube[123] = cube_tmp[124];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[136];
        cube[126] = cube_tmp[142];
        cube[127] = cube_tmp[111];
        cube[128] = cube_tmp[117];
        cube[129] = cube_tmp[123];
        cube[130] = cube_tmp[129];
        cube[131] = cube_tmp[135];
        cube[132] = cube_tmp[141];
        cube[133] = cube_tmp[110];
        cube[134] = cube_tmp[116];
        cube[135] = cube_tmp[122];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[134];
        cube[138] = cube_tmp[140];
        cube[139] = cube_tmp[109];
        cube[140] = cube_tmp[115];
        cube[141] = cube_tmp[121];
        cube[142] = cube_tmp[127];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[139];
        cube[145] = cube_tmp[216];
        cube[146] = cube_tmp[215];
        cube[151] = cube_tmp[210];
        cube[152] = cube_tmp[209];
        cube[157] = cube_tmp[204];
        cube[158] = cube_tmp[203];
        cube[163] = cube_tmp[198];
        cube[164] = cube_tmp[197];
        cube[169] = cube_tmp[192];
        cube[170] = cube_tmp[191];
        cube[175] = cube_tmp[186];
        cube[176] = cube_tmp[185];
        cube[185] = cube_tmp[77];
        cube[186] = cube_tmp[78];
        cube[191] = cube_tmp[83];
        cube[192] = cube_tmp[84];
        cube[197] = cube_tmp[89];
        cube[198] = cube_tmp[90];
        cube[203] = cube_tmp[95];
        cube[204] = cube_tmp[96];
        cube[209] = cube_tmp[101];
        cube[210] = cube_tmp[102];
        cube[215] = cube_tmp[107];
        cube[216] = cube_tmp[108];
        break;

    case Rw2:
        cube[5] = cube_tmp[185];
        cube[6] = cube_tmp[186];
        cube[11] = cube_tmp[191];
        cube[12] = cube_tmp[192];
        cube[17] = cube_tmp[197];
        cube[18] = cube_tmp[198];
        cube[23] = cube_tmp[203];
        cube[24] = cube_tmp[204];
        cube[29] = cube_tmp[209];
        cube[30] = cube_tmp[210];
        cube[35] = cube_tmp[215];
        cube[36] = cube_tmp[216];
        cube[77] = cube_tmp[176];
        cube[78] = cube_tmp[175];
        cube[83] = cube_tmp[170];
        cube[84] = cube_tmp[169];
        cube[89] = cube_tmp[164];
        cube[90] = cube_tmp[163];
        cube[95] = cube_tmp[158];
        cube[96] = cube_tmp[157];
        cube[101] = cube_tmp[152];
        cube[102] = cube_tmp[151];
        cube[107] = cube_tmp[146];
        cube[108] = cube_tmp[145];
        cube[109] = cube_tmp[144];
        cube[110] = cube_tmp[143];
        cube[111] = cube_tmp[142];
        cube[112] = cube_tmp[141];
        cube[113] = cube_tmp[140];
        cube[114] = cube_tmp[139];
        cube[115] = cube_tmp[138];
        cube[116] = cube_tmp[137];
        cube[117] = cube_tmp[136];
        cube[118] = cube_tmp[135];
        cube[119] = cube_tmp[134];
        cube[120] = cube_tmp[133];
        cube[121] = cube_tmp[132];
        cube[122] = cube_tmp[131];
        cube[123] = cube_tmp[130];
        cube[124] = cube_tmp[129];
        cube[125] = cube_tmp[128];
        cube[126] = cube_tmp[127];
        cube[127] = cube_tmp[126];
        cube[128] = cube_tmp[125];
        cube[129] = cube_tmp[124];
        cube[130] = cube_tmp[123];
        cube[131] = cube_tmp[122];
        cube[132] = cube_tmp[121];
        cube[133] = cube_tmp[120];
        cube[134] = cube_tmp[119];
        cube[135] = cube_tmp[118];
        cube[136] = cube_tmp[117];
        cube[137] = cube_tmp[116];
        cube[138] = cube_tmp[115];
        cube[139] = cube_tmp[114];
        cube[140] = cube_tmp[113];
        cube[141] = cube_tmp[112];
        cube[142] = cube_tmp[111];
        cube[143] = cube_tmp[110];
        cube[144] = cube_tmp[109];
        cube[145] = cube_tmp[108];
        cube[146] = cube_tmp[107];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[101];
        cube[157] = cube_tmp[96];
        cube[158] = cube_tmp[95];
        cube[163] = cube_tmp[90];
        cube[164] = cube_tmp[89];
        cube[169] = cube_tmp[84];
        cube[170] = cube_tmp[83];
        cube[175] = cube_tmp[78];
        cube[176] = cube_tmp[77];
        cube[185] = cube_tmp[5];
        cube[186] = cube_tmp[6];
        cube[191] = cube_tmp[11];
        cube[192] = cube_tmp[12];
        cube[197] = cube_tmp[17];
        cube[198] = cube_tmp[18];
        cube[203] = cube_tmp[23];
        cube[204] = cube_tmp[24];
        cube[209] = cube_tmp[29];
        cube[210] = cube_tmp[30];
        cube[215] = cube_tmp[35];
        cube[216] = cube_tmp[36];
        break;

    case threeRw:
        cube[4] = cube_tmp[76];
        cube[5] = cube_tmp[77];
        cube[6] = cube_tmp[78];
        cube[10] = cube_tmp[82];
        cube[11] = cube_tmp[83];
        cube[12] = cube_tmp[84];
        cube[16] = cube_tmp[88];
        cube[17] = cube_tmp[89];
        cube[18] = cube_tmp[90];
        cube[22] = cube_tmp[94];
        cube[23] = cube_tmp[95];
        cube[24] = cube_tmp[96];
        cube[28] = cube_tmp[100];
        cube[29] = cube_tmp[101];
        cube[30] = cube_tmp[102];
        cube[34] = cube_tmp[106];
        cube[35] = cube_tmp[107];
        cube[36] = cube_tmp[108];
        cube[76] = cube_tmp[184];
        cube[77] = cube_tmp[185];
        cube[78] = cube_tmp[186];
        cube[82] = cube_tmp[190];
        cube[83] = cube_tmp[191];
        cube[84] = cube_tmp[192];
        cube[88] = cube_tmp[196];
        cube[89] = cube_tmp[197];
        cube[90] = cube_tmp[198];
        cube[94] = cube_tmp[202];
        cube[95] = cube_tmp[203];
        cube[96] = cube_tmp[204];
        cube[100] = cube_tmp[208];
        cube[101] = cube_tmp[209];
        cube[102] = cube_tmp[210];
        cube[106] = cube_tmp[214];
        cube[107] = cube_tmp[215];
        cube[108] = cube_tmp[216];
        cube[109] = cube_tmp[139];
        cube[110] = cube_tmp[133];
        cube[111] = cube_tmp[127];
        cube[112] = cube_tmp[121];
        cube[113] = cube_tmp[115];
        cube[114] = cube_tmp[109];
        cube[115] = cube_tmp[140];
        cube[116] = cube_tmp[134];
        cube[117] = cube_tmp[128];
        cube[118] = cube_tmp[122];
        cube[119] = cube_tmp[116];
        cube[120] = cube_tmp[110];
        cube[121] = cube_tmp[141];
        cube[122] = cube_tmp[135];
        cube[123] = cube_tmp[129];
        cube[124] = cube_tmp[123];
        cube[125] = cube_tmp[117];
        cube[126] = cube_tmp[111];
        cube[127] = cube_tmp[142];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[130];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[118];
        cube[132] = cube_tmp[112];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[137];
        cube[135] = cube_tmp[131];
        cube[136] = cube_tmp[125];
        cube[137] = cube_tmp[119];
        cube[138] = cube_tmp[113];
        cube[139] = cube_tmp[144];
        cube[140] = cube_tmp[138];
        cube[141] = cube_tmp[132];
        cube[142] = cube_tmp[126];
        cube[143] = cube_tmp[120];
        cube[144] = cube_tmp[114];
        cube[145] = cube_tmp[36];
        cube[146] = cube_tmp[35];
        cube[147] = cube_tmp[34];
        cube[151] = cube_tmp[30];
        cube[152] = cube_tmp[29];
        cube[153] = cube_tmp[28];
        cube[157] = cube_tmp[24];
        cube[158] = cube_tmp[23];
        cube[159] = cube_tmp[22];
        cube[163] = cube_tmp[18];
        cube[164] = cube_tmp[17];
        cube[165] = cube_tmp[16];
        cube[169] = cube_tmp[12];
        cube[170] = cube_tmp[11];
        cube[171] = cube_tmp[10];
        cube[175] = cube_tmp[6];
        cube[176] = cube_tmp[5];
        cube[177] = cube_tmp[4];
        cube[184] = cube_tmp[177];
        cube[185] = cube_tmp[176];
        cube[186] = cube_tmp[175];
        cube[190] = cube_tmp[171];
        cube[191] = cube_tmp[170];
        cube[192] = cube_tmp[169];
        cube[196] = cube_tmp[165];
        cube[197] = cube_tmp[164];
        cube[198] = cube_tmp[163];
        cube[202] = cube_tmp[159];
        cube[203] = cube_tmp[158];
        cube[204] = cube_tmp[157];
        cube[208] = cube_tmp[153];
        cube[209] = cube_tmp[152];
        cube[210] = cube_tmp[151];
        cube[214] = cube_tmp[147];
        cube[215] = cube_tmp[146];
        cube[216] = cube_tmp[145];
        break;

    case threeRw_PRIME:
        cube[4] = cube_tmp[177];
        cube[5] = cube_tmp[176];
        cube[6] = cube_tmp[175];
        cube[10] = cube_tmp[171];
        cube[11] = cube_tmp[170];
        cube[12] = cube_tmp[169];
        cube[16] = cube_tmp[165];
        cube[17] = cube_tmp[164];
        cube[18] = cube_tmp[163];
        cube[22] = cube_tmp[159];
        cube[23] = cube_tmp[158];
        cube[24] = cube_tmp[157];
        cube[28] = cube_tmp[153];
        cube[29] = cube_tmp[152];
        cube[30] = cube_tmp[151];
        cube[34] = cube_tmp[147];
        cube[35] = cube_tmp[146];
        cube[36] = cube_tmp[145];
        cube[76] = cube_tmp[4];
        cube[77] = cube_tmp[5];
        cube[78] = cube_tmp[6];
        cube[82] = cube_tmp[10];
        cube[83] = cube_tmp[11];
        cube[84] = cube_tmp[12];
        cube[88] = cube_tmp[16];
        cube[89] = cube_tmp[17];
        cube[90] = cube_tmp[18];
        cube[94] = cube_tmp[22];
        cube[95] = cube_tmp[23];
        cube[96] = cube_tmp[24];
        cube[100] = cube_tmp[28];
        cube[101] = cube_tmp[29];
        cube[102] = cube_tmp[30];
        cube[106] = cube_tmp[34];
        cube[107] = cube_tmp[35];
        cube[108] = cube_tmp[36];
        cube[109] = cube_tmp[114];
        cube[110] = cube_tmp[120];
        cube[111] = cube_tmp[126];
        cube[112] = cube_tmp[132];
        cube[113] = cube_tmp[138];
        cube[114] = cube_tmp[144];
        cube[115] = cube_tmp[113];
        cube[116] = cube_tmp[119];
        cube[117] = cube_tmp[125];
        cube[118] = cube_tmp[131];
        cube[119] = cube_tmp[137];
        cube[120] = cube_tmp[143];
        cube[121] = cube_tmp[112];
        cube[122] = cube_tmp[118];
        cube[123] = cube_tmp[124];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[136];
        cube[126] = cube_tmp[142];
        cube[127] = cube_tmp[111];
        cube[128] = cube_tmp[117];
        cube[129] = cube_tmp[123];
        cube[130] = cube_tmp[129];
        cube[131] = cube_tmp[135];
        cube[132] = cube_tmp[141];
        cube[133] = cube_tmp[110];
        cube[134] = cube_tmp[116];
        cube[135] = cube_tmp[122];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[134];
        cube[138] = cube_tmp[140];
        cube[139] = cube_tmp[109];
        cube[140] = cube_tmp[115];
        cube[141] = cube_tmp[121];
        cube[142] = cube_tmp[127];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[139];
        cube[145] = cube_tmp[216];
        cube[146] = cube_tmp[215];
        cube[147] = cube_tmp[214];
        cube[151] = cube_tmp[210];
        cube[152] = cube_tmp[209];
        cube[153] = cube_tmp[208];
        cube[157] = cube_tmp[204];
        cube[158] = cube_tmp[203];
        cube[159] = cube_tmp[202];
        cube[163] = cube_tmp[198];
        cube[164] = cube_tmp[197];
        cube[165] = cube_tmp[196];
        cube[169] = cube_tmp[192];
        cube[170] = cube_tmp[191];
        cube[171] = cube_tmp[190];
        cube[175] = cube_tmp[186];
        cube[176] = cube_tmp[185];
        cube[177] = cube_tmp[184];
        cube[184] = cube_tmp[76];
        cube[185] = cube_tmp[77];
        cube[186] = cube_tmp[78];
        cube[190] = cube_tmp[82];
        cube[191] = cube_tmp[83];
        cube[192] = cube_tmp[84];
        cube[196] = cube_tmp[88];
        cube[197] = cube_tmp[89];
        cube[198] = cube_tmp[90];
        cube[202] = cube_tmp[94];
        cube[203] = cube_tmp[95];
        cube[204] = cube_tmp[96];
        cube[208] = cube_tmp[100];
        cube[209] = cube_tmp[101];
        cube[210] = cube_tmp[102];
        cube[214] = cube_tmp[106];
        cube[215] = cube_tmp[107];
        cube[216] = cube_tmp[108];
        break;

    case threeRw2:
        cube[4] = cube_tmp[184];
        cube[5] = cube_tmp[185];
        cube[6] = cube_tmp[186];
        cube[10] = cube_tmp[190];
        cube[11] = cube_tmp[191];
        cube[12] = cube_tmp[192];
        cube[16] = cube_tmp[196];
        cube[17] = cube_tmp[197];
        cube[18] = cube_tmp[198];
        cube[22] = cube_tmp[202];
        cube[23] = cube_tmp[203];
        cube[24] = cube_tmp[204];
        cube[28] = cube_tmp[208];
        cube[29] = cube_tmp[209];
        cube[30] = cube_tmp[210];
        cube[34] = cube_tmp[214];
        cube[35] = cube_tmp[215];
        cube[36] = cube_tmp[216];
        cube[76] = cube_tmp[177];
        cube[77] = cube_tmp[176];
        cube[78] = cube_tmp[175];
        cube[82] = cube_tmp[171];
        cube[83] = cube_tmp[170];
        cube[84] = cube_tmp[169];
        cube[88] = cube_tmp[165];
        cube[89] = cube_tmp[164];
        cube[90] = cube_tmp[163];
        cube[94] = cube_tmp[159];
        cube[95] = cube_tmp[158];
        cube[96] = cube_tmp[157];
        cube[100] = cube_tmp[153];
        cube[101] = cube_tmp[152];
        cube[102] = cube_tmp[151];
        cube[106] = cube_tmp[147];
        cube[107] = cube_tmp[146];
        cube[108] = cube_tmp[145];
        cube[109] = cube_tmp[144];
        cube[110] = cube_tmp[143];
        cube[111] = cube_tmp[142];
        cube[112] = cube_tmp[141];
        cube[113] = cube_tmp[140];
        cube[114] = cube_tmp[139];
        cube[115] = cube_tmp[138];
        cube[116] = cube_tmp[137];
        cube[117] = cube_tmp[136];
        cube[118] = cube_tmp[135];
        cube[119] = cube_tmp[134];
        cube[120] = cube_tmp[133];
        cube[121] = cube_tmp[132];
        cube[122] = cube_tmp[131];
        cube[123] = cube_tmp[130];
        cube[124] = cube_tmp[129];
        cube[125] = cube_tmp[128];
        cube[126] = cube_tmp[127];
        cube[127] = cube_tmp[126];
        cube[128] = cube_tmp[125];
        cube[129] = cube_tmp[124];
        cube[130] = cube_tmp[123];
        cube[131] = cube_tmp[122];
        cube[132] = cube_tmp[121];
        cube[133] = cube_tmp[120];
        cube[134] = cube_tmp[119];
        cube[135] = cube_tmp[118];
        cube[136] = cube_tmp[117];
        cube[137] = cube_tmp[116];
        cube[138] = cube_tmp[115];
        cube[139] = cube_tmp[114];
        cube[140] = cube_tmp[113];
        cube[141] = cube_tmp[112];
        cube[142] = cube_tmp[111];
        cube[143] = cube_tmp[110];
        cube[144] = cube_tmp[109];
        cube[145] = cube_tmp[108];
        cube[146] = cube_tmp[107];
        cube[147] = cube_tmp[106];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[101];
        cube[153] = cube_tmp[100];
        cube[157] = cube_tmp[96];
        cube[158] = cube_tmp[95];
        cube[159] = cube_tmp[94];
        cube[163] = cube_tmp[90];
        cube[164] = cube_tmp[89];
        cube[165] = cube_tmp[88];
        cube[169] = cube_tmp[84];
        cube[170] = cube_tmp[83];
        cube[171] = cube_tmp[82];
        cube[175] = cube_tmp[78];
        cube[176] = cube_tmp[77];
        cube[177] = cube_tmp[76];
        cube[184] = cube_tmp[4];
        cube[185] = cube_tmp[5];
        cube[186] = cube_tmp[6];
        cube[190] = cube_tmp[10];
        cube[191] = cube_tmp[11];
        cube[192] = cube_tmp[12];
        cube[196] = cube_tmp[16];
        cube[197] = cube_tmp[17];
        cube[198] = cube_tmp[18];
        cube[202] = cube_tmp[22];
        cube[203] = cube_tmp[23];
        cube[204] = cube_tmp[24];
        cube[208] = cube_tmp[28];
        cube[209] = cube_tmp[29];
        cube[210] = cube_tmp[30];
        cube[214] = cube_tmp[34];
        cube[215] = cube_tmp[35];
        cube[216] = cube_tmp[36];
        break;

    case B:
        cube[1] = cube_tmp[114];
        cube[2] = cube_tmp[120];
        cube[3] = cube_tmp[126];
        cube[4] = cube_tmp[132];
        cube[5] = cube_tmp[138];
        cube[6] = cube_tmp[144];
        cube[37] = cube_tmp[6];
        cube[43] = cube_tmp[5];
        cube[49] = cube_tmp[4];
        cube[55] = cube_tmp[3];
        cube[61] = cube_tmp[2];
        cube[67] = cube_tmp[1];
        cube[114] = cube_tmp[216];
        cube[120] = cube_tmp[215];
        cube[126] = cube_tmp[214];
        cube[132] = cube_tmp[213];
        cube[138] = cube_tmp[212];
        cube[144] = cube_tmp[211];
        cube[145] = cube_tmp[175];
        cube[146] = cube_tmp[169];
        cube[147] = cube_tmp[163];
        cube[148] = cube_tmp[157];
        cube[149] = cube_tmp[151];
        cube[150] = cube_tmp[145];
        cube[151] = cube_tmp[176];
        cube[152] = cube_tmp[170];
        cube[153] = cube_tmp[164];
        cube[154] = cube_tmp[158];
        cube[155] = cube_tmp[152];
        cube[156] = cube_tmp[146];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[171];
        cube[159] = cube_tmp[165];
        cube[160] = cube_tmp[159];
        cube[161] = cube_tmp[153];
        cube[162] = cube_tmp[147];
        cube[163] = cube_tmp[178];
        cube[164] = cube_tmp[172];
        cube[165] = cube_tmp[166];
        cube[166] = cube_tmp[160];
        cube[167] = cube_tmp[154];
        cube[168] = cube_tmp[148];
        cube[169] = cube_tmp[179];
        cube[170] = cube_tmp[173];
        cube[171] = cube_tmp[167];
        cube[172] = cube_tmp[161];
        cube[173] = cube_tmp[155];
        cube[174] = cube_tmp[149];
        cube[175] = cube_tmp[180];
        cube[176] = cube_tmp[174];
        cube[177] = cube_tmp[168];
        cube[178] = cube_tmp[162];
        cube[179] = cube_tmp[156];
        cube[180] = cube_tmp[150];
        cube[211] = cube_tmp[37];
        cube[212] = cube_tmp[43];
        cube[213] = cube_tmp[49];
        cube[214] = cube_tmp[55];
        cube[215] = cube_tmp[61];
        cube[216] = cube_tmp[67];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[67];
        cube[2] = cube_tmp[61];
        cube[3] = cube_tmp[55];
        cube[4] = cube_tmp[49];
        cube[5] = cube_tmp[43];
        cube[6] = cube_tmp[37];
        cube[37] = cube_tmp[211];
        cube[43] = cube_tmp[212];
        cube[49] = cube_tmp[213];
        cube[55] = cube_tmp[214];
        cube[61] = cube_tmp[215];
        cube[67] = cube_tmp[216];
        cube[114] = cube_tmp[1];
        cube[120] = cube_tmp[2];
        cube[126] = cube_tmp[3];
        cube[132] = cube_tmp[4];
        cube[138] = cube_tmp[5];
        cube[144] = cube_tmp[6];
        cube[145] = cube_tmp[150];
        cube[146] = cube_tmp[156];
        cube[147] = cube_tmp[162];
        cube[148] = cube_tmp[168];
        cube[149] = cube_tmp[174];
        cube[150] = cube_tmp[180];
        cube[151] = cube_tmp[149];
        cube[152] = cube_tmp[155];
        cube[153] = cube_tmp[161];
        cube[154] = cube_tmp[167];
        cube[155] = cube_tmp[173];
        cube[156] = cube_tmp[179];
        cube[157] = cube_tmp[148];
        cube[158] = cube_tmp[154];
        cube[159] = cube_tmp[160];
        cube[160] = cube_tmp[166];
        cube[161] = cube_tmp[172];
        cube[162] = cube_tmp[178];
        cube[163] = cube_tmp[147];
        cube[164] = cube_tmp[153];
        cube[165] = cube_tmp[159];
        cube[166] = cube_tmp[165];
        cube[167] = cube_tmp[171];
        cube[168] = cube_tmp[177];
        cube[169] = cube_tmp[146];
        cube[170] = cube_tmp[152];
        cube[171] = cube_tmp[158];
        cube[172] = cube_tmp[164];
        cube[173] = cube_tmp[170];
        cube[174] = cube_tmp[176];
        cube[175] = cube_tmp[145];
        cube[176] = cube_tmp[151];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[163];
        cube[179] = cube_tmp[169];
        cube[180] = cube_tmp[175];
        cube[211] = cube_tmp[144];
        cube[212] = cube_tmp[138];
        cube[213] = cube_tmp[132];
        cube[214] = cube_tmp[126];
        cube[215] = cube_tmp[120];
        cube[216] = cube_tmp[114];
        break;

    case B2:
        cube[1] = cube_tmp[216];
        cube[2] = cube_tmp[215];
        cube[3] = cube_tmp[214];
        cube[4] = cube_tmp[213];
        cube[5] = cube_tmp[212];
        cube[6] = cube_tmp[211];
        cube[37] = cube_tmp[144];
        cube[43] = cube_tmp[138];
        cube[49] = cube_tmp[132];
        cube[55] = cube_tmp[126];
        cube[61] = cube_tmp[120];
        cube[67] = cube_tmp[114];
        cube[114] = cube_tmp[67];
        cube[120] = cube_tmp[61];
        cube[126] = cube_tmp[55];
        cube[132] = cube_tmp[49];
        cube[138] = cube_tmp[43];
        cube[144] = cube_tmp[37];
        cube[145] = cube_tmp[180];
        cube[146] = cube_tmp[179];
        cube[147] = cube_tmp[178];
        cube[148] = cube_tmp[177];
        cube[149] = cube_tmp[176];
        cube[150] = cube_tmp[175];
        cube[151] = cube_tmp[174];
        cube[152] = cube_tmp[173];
        cube[153] = cube_tmp[172];
        cube[154] = cube_tmp[171];
        cube[155] = cube_tmp[170];
        cube[156] = cube_tmp[169];
        cube[157] = cube_tmp[168];
        cube[158] = cube_tmp[167];
        cube[159] = cube_tmp[166];
        cube[160] = cube_tmp[165];
        cube[161] = cube_tmp[164];
        cube[162] = cube_tmp[163];
        cube[163] = cube_tmp[162];
        cube[164] = cube_tmp[161];
        cube[165] = cube_tmp[160];
        cube[166] = cube_tmp[159];
        cube[167] = cube_tmp[158];
        cube[168] = cube_tmp[157];
        cube[169] = cube_tmp[156];
        cube[170] = cube_tmp[155];
        cube[171] = cube_tmp[154];
        cube[172] = cube_tmp[153];
        cube[173] = cube_tmp[152];
        cube[174] = cube_tmp[151];
        cube[175] = cube_tmp[150];
        cube[176] = cube_tmp[149];
        cube[177] = cube_tmp[148];
        cube[178] = cube_tmp[147];
        cube[179] = cube_tmp[146];
        cube[180] = cube_tmp[145];
        cube[211] = cube_tmp[6];
        cube[212] = cube_tmp[5];
        cube[213] = cube_tmp[4];
        cube[214] = cube_tmp[3];
        cube[215] = cube_tmp[2];
        cube[216] = cube_tmp[1];
        break;

    case Bw:
        cube[1] = cube_tmp[114];
        cube[2] = cube_tmp[120];
        cube[3] = cube_tmp[126];
        cube[4] = cube_tmp[132];
        cube[5] = cube_tmp[138];
        cube[6] = cube_tmp[144];
        cube[7] = cube_tmp[113];
        cube[8] = cube_tmp[119];
        cube[9] = cube_tmp[125];
        cube[10] = cube_tmp[131];
        cube[11] = cube_tmp[137];
        cube[12] = cube_tmp[143];
        cube[37] = cube_tmp[6];
        cube[38] = cube_tmp[12];
        cube[43] = cube_tmp[5];
        cube[44] = cube_tmp[11];
        cube[49] = cube_tmp[4];
        cube[50] = cube_tmp[10];
        cube[55] = cube_tmp[3];
        cube[56] = cube_tmp[9];
        cube[61] = cube_tmp[2];
        cube[62] = cube_tmp[8];
        cube[67] = cube_tmp[1];
        cube[68] = cube_tmp[7];
        cube[113] = cube_tmp[210];
        cube[114] = cube_tmp[216];
        cube[119] = cube_tmp[209];
        cube[120] = cube_tmp[215];
        cube[125] = cube_tmp[208];
        cube[126] = cube_tmp[214];
        cube[131] = cube_tmp[207];
        cube[132] = cube_tmp[213];
        cube[137] = cube_tmp[206];
        cube[138] = cube_tmp[212];
        cube[143] = cube_tmp[205];
        cube[144] = cube_tmp[211];
        cube[145] = cube_tmp[175];
        cube[146] = cube_tmp[169];
        cube[147] = cube_tmp[163];
        cube[148] = cube_tmp[157];
        cube[149] = cube_tmp[151];
        cube[150] = cube_tmp[145];
        cube[151] = cube_tmp[176];
        cube[152] = cube_tmp[170];
        cube[153] = cube_tmp[164];
        cube[154] = cube_tmp[158];
        cube[155] = cube_tmp[152];
        cube[156] = cube_tmp[146];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[171];
        cube[159] = cube_tmp[165];
        cube[160] = cube_tmp[159];
        cube[161] = cube_tmp[153];
        cube[162] = cube_tmp[147];
        cube[163] = cube_tmp[178];
        cube[164] = cube_tmp[172];
        cube[165] = cube_tmp[166];
        cube[166] = cube_tmp[160];
        cube[167] = cube_tmp[154];
        cube[168] = cube_tmp[148];
        cube[169] = cube_tmp[179];
        cube[170] = cube_tmp[173];
        cube[171] = cube_tmp[167];
        cube[172] = cube_tmp[161];
        cube[173] = cube_tmp[155];
        cube[174] = cube_tmp[149];
        cube[175] = cube_tmp[180];
        cube[176] = cube_tmp[174];
        cube[177] = cube_tmp[168];
        cube[178] = cube_tmp[162];
        cube[179] = cube_tmp[156];
        cube[180] = cube_tmp[150];
        cube[205] = cube_tmp[38];
        cube[206] = cube_tmp[44];
        cube[207] = cube_tmp[50];
        cube[208] = cube_tmp[56];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[68];
        cube[211] = cube_tmp[37];
        cube[212] = cube_tmp[43];
        cube[213] = cube_tmp[49];
        cube[214] = cube_tmp[55];
        cube[215] = cube_tmp[61];
        cube[216] = cube_tmp[67];
        break;

    case Bw_PRIME:
        cube[1] = cube_tmp[67];
        cube[2] = cube_tmp[61];
        cube[3] = cube_tmp[55];
        cube[4] = cube_tmp[49];
        cube[5] = cube_tmp[43];
        cube[6] = cube_tmp[37];
        cube[7] = cube_tmp[68];
        cube[8] = cube_tmp[62];
        cube[9] = cube_tmp[56];
        cube[10] = cube_tmp[50];
        cube[11] = cube_tmp[44];
        cube[12] = cube_tmp[38];
        cube[37] = cube_tmp[211];
        cube[38] = cube_tmp[205];
        cube[43] = cube_tmp[212];
        cube[44] = cube_tmp[206];
        cube[49] = cube_tmp[213];
        cube[50] = cube_tmp[207];
        cube[55] = cube_tmp[214];
        cube[56] = cube_tmp[208];
        cube[61] = cube_tmp[215];
        cube[62] = cube_tmp[209];
        cube[67] = cube_tmp[216];
        cube[68] = cube_tmp[210];
        cube[113] = cube_tmp[7];
        cube[114] = cube_tmp[1];
        cube[119] = cube_tmp[8];
        cube[120] = cube_tmp[2];
        cube[125] = cube_tmp[9];
        cube[126] = cube_tmp[3];
        cube[131] = cube_tmp[10];
        cube[132] = cube_tmp[4];
        cube[137] = cube_tmp[11];
        cube[138] = cube_tmp[5];
        cube[143] = cube_tmp[12];
        cube[144] = cube_tmp[6];
        cube[145] = cube_tmp[150];
        cube[146] = cube_tmp[156];
        cube[147] = cube_tmp[162];
        cube[148] = cube_tmp[168];
        cube[149] = cube_tmp[174];
        cube[150] = cube_tmp[180];
        cube[151] = cube_tmp[149];
        cube[152] = cube_tmp[155];
        cube[153] = cube_tmp[161];
        cube[154] = cube_tmp[167];
        cube[155] = cube_tmp[173];
        cube[156] = cube_tmp[179];
        cube[157] = cube_tmp[148];
        cube[158] = cube_tmp[154];
        cube[159] = cube_tmp[160];
        cube[160] = cube_tmp[166];
        cube[161] = cube_tmp[172];
        cube[162] = cube_tmp[178];
        cube[163] = cube_tmp[147];
        cube[164] = cube_tmp[153];
        cube[165] = cube_tmp[159];
        cube[166] = cube_tmp[165];
        cube[167] = cube_tmp[171];
        cube[168] = cube_tmp[177];
        cube[169] = cube_tmp[146];
        cube[170] = cube_tmp[152];
        cube[171] = cube_tmp[158];
        cube[172] = cube_tmp[164];
        cube[173] = cube_tmp[170];
        cube[174] = cube_tmp[176];
        cube[175] = cube_tmp[145];
        cube[176] = cube_tmp[151];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[163];
        cube[179] = cube_tmp[169];
        cube[180] = cube_tmp[175];
        cube[205] = cube_tmp[143];
        cube[206] = cube_tmp[137];
        cube[207] = cube_tmp[131];
        cube[208] = cube_tmp[125];
        cube[209] = cube_tmp[119];
        cube[210] = cube_tmp[113];
        cube[211] = cube_tmp[144];
        cube[212] = cube_tmp[138];
        cube[213] = cube_tmp[132];
        cube[214] = cube_tmp[126];
        cube[215] = cube_tmp[120];
        cube[216] = cube_tmp[114];
        break;

    case Bw2:
        cube[1] = cube_tmp[216];
        cube[2] = cube_tmp[215];
        cube[3] = cube_tmp[214];
        cube[4] = cube_tmp[213];
        cube[5] = cube_tmp[212];
        cube[6] = cube_tmp[211];
        cube[7] = cube_tmp[210];
        cube[8] = cube_tmp[209];
        cube[9] = cube_tmp[208];
        cube[10] = cube_tmp[207];
        cube[11] = cube_tmp[206];
        cube[12] = cube_tmp[205];
        cube[37] = cube_tmp[144];
        cube[38] = cube_tmp[143];
        cube[43] = cube_tmp[138];
        cube[44] = cube_tmp[137];
        cube[49] = cube_tmp[132];
        cube[50] = cube_tmp[131];
        cube[55] = cube_tmp[126];
        cube[56] = cube_tmp[125];
        cube[61] = cube_tmp[120];
        cube[62] = cube_tmp[119];
        cube[67] = cube_tmp[114];
        cube[68] = cube_tmp[113];
        cube[113] = cube_tmp[68];
        cube[114] = cube_tmp[67];
        cube[119] = cube_tmp[62];
        cube[120] = cube_tmp[61];
        cube[125] = cube_tmp[56];
        cube[126] = cube_tmp[55];
        cube[131] = cube_tmp[50];
        cube[132] = cube_tmp[49];
        cube[137] = cube_tmp[44];
        cube[138] = cube_tmp[43];
        cube[143] = cube_tmp[38];
        cube[144] = cube_tmp[37];
        cube[145] = cube_tmp[180];
        cube[146] = cube_tmp[179];
        cube[147] = cube_tmp[178];
        cube[148] = cube_tmp[177];
        cube[149] = cube_tmp[176];
        cube[150] = cube_tmp[175];
        cube[151] = cube_tmp[174];
        cube[152] = cube_tmp[173];
        cube[153] = cube_tmp[172];
        cube[154] = cube_tmp[171];
        cube[155] = cube_tmp[170];
        cube[156] = cube_tmp[169];
        cube[157] = cube_tmp[168];
        cube[158] = cube_tmp[167];
        cube[159] = cube_tmp[166];
        cube[160] = cube_tmp[165];
        cube[161] = cube_tmp[164];
        cube[162] = cube_tmp[163];
        cube[163] = cube_tmp[162];
        cube[164] = cube_tmp[161];
        cube[165] = cube_tmp[160];
        cube[166] = cube_tmp[159];
        cube[167] = cube_tmp[158];
        cube[168] = cube_tmp[157];
        cube[169] = cube_tmp[156];
        cube[170] = cube_tmp[155];
        cube[171] = cube_tmp[154];
        cube[172] = cube_tmp[153];
        cube[173] = cube_tmp[152];
        cube[174] = cube_tmp[151];
        cube[175] = cube_tmp[150];
        cube[176] = cube_tmp[149];
        cube[177] = cube_tmp[148];
        cube[178] = cube_tmp[147];
        cube[179] = cube_tmp[146];
        cube[180] = cube_tmp[145];
        cube[205] = cube_tmp[12];
        cube[206] = cube_tmp[11];
        cube[207] = cube_tmp[10];
        cube[208] = cube_tmp[9];
        cube[209] = cube_tmp[8];
        cube[210] = cube_tmp[7];
        cube[211] = cube_tmp[6];
        cube[212] = cube_tmp[5];
        cube[213] = cube_tmp[4];
        cube[214] = cube_tmp[3];
        cube[215] = cube_tmp[2];
        cube[216] = cube_tmp[1];
        break;

    case threeBw:
        cube[1] = cube_tmp[114];
        cube[2] = cube_tmp[120];
        cube[3] = cube_tmp[126];
        cube[4] = cube_tmp[132];
        cube[5] = cube_tmp[138];
        cube[6] = cube_tmp[144];
        cube[7] = cube_tmp[113];
        cube[8] = cube_tmp[119];
        cube[9] = cube_tmp[125];
        cube[10] = cube_tmp[131];
        cube[11] = cube_tmp[137];
        cube[12] = cube_tmp[143];
        cube[13] = cube_tmp[112];
        cube[14] = cube_tmp[118];
        cube[15] = cube_tmp[124];
        cube[16] = cube_tmp[130];
        cube[17] = cube_tmp[136];
        cube[18] = cube_tmp[142];
        cube[37] = cube_tmp[6];
        cube[38] = cube_tmp[12];
        cube[39] = cube_tmp[18];
        cube[43] = cube_tmp[5];
        cube[44] = cube_tmp[11];
        cube[45] = cube_tmp[17];
        cube[49] = cube_tmp[4];
        cube[50] = cube_tmp[10];
        cube[51] = cube_tmp[16];
        cube[55] = cube_tmp[3];
        cube[56] = cube_tmp[9];
        cube[57] = cube_tmp[15];
        cube[61] = cube_tmp[2];
        cube[62] = cube_tmp[8];
        cube[63] = cube_tmp[14];
        cube[67] = cube_tmp[1];
        cube[68] = cube_tmp[7];
        cube[69] = cube_tmp[13];
        cube[112] = cube_tmp[204];
        cube[113] = cube_tmp[210];
        cube[114] = cube_tmp[216];
        cube[118] = cube_tmp[203];
        cube[119] = cube_tmp[209];
        cube[120] = cube_tmp[215];
        cube[124] = cube_tmp[202];
        cube[125] = cube_tmp[208];
        cube[126] = cube_tmp[214];
        cube[130] = cube_tmp[201];
        cube[131] = cube_tmp[207];
        cube[132] = cube_tmp[213];
        cube[136] = cube_tmp[200];
        cube[137] = cube_tmp[206];
        cube[138] = cube_tmp[212];
        cube[142] = cube_tmp[199];
        cube[143] = cube_tmp[205];
        cube[144] = cube_tmp[211];
        cube[145] = cube_tmp[175];
        cube[146] = cube_tmp[169];
        cube[147] = cube_tmp[163];
        cube[148] = cube_tmp[157];
        cube[149] = cube_tmp[151];
        cube[150] = cube_tmp[145];
        cube[151] = cube_tmp[176];
        cube[152] = cube_tmp[170];
        cube[153] = cube_tmp[164];
        cube[154] = cube_tmp[158];
        cube[155] = cube_tmp[152];
        cube[156] = cube_tmp[146];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[171];
        cube[159] = cube_tmp[165];
        cube[160] = cube_tmp[159];
        cube[161] = cube_tmp[153];
        cube[162] = cube_tmp[147];
        cube[163] = cube_tmp[178];
        cube[164] = cube_tmp[172];
        cube[165] = cube_tmp[166];
        cube[166] = cube_tmp[160];
        cube[167] = cube_tmp[154];
        cube[168] = cube_tmp[148];
        cube[169] = cube_tmp[179];
        cube[170] = cube_tmp[173];
        cube[171] = cube_tmp[167];
        cube[172] = cube_tmp[161];
        cube[173] = cube_tmp[155];
        cube[174] = cube_tmp[149];
        cube[175] = cube_tmp[180];
        cube[176] = cube_tmp[174];
        cube[177] = cube_tmp[168];
        cube[178] = cube_tmp[162];
        cube[179] = cube_tmp[156];
        cube[180] = cube_tmp[150];
        cube[199] = cube_tmp[39];
        cube[200] = cube_tmp[45];
        cube[201] = cube_tmp[51];
        cube[202] = cube_tmp[57];
        cube[203] = cube_tmp[63];
        cube[204] = cube_tmp[69];
        cube[205] = cube_tmp[38];
        cube[206] = cube_tmp[44];
        cube[207] = cube_tmp[50];
        cube[208] = cube_tmp[56];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[68];
        cube[211] = cube_tmp[37];
        cube[212] = cube_tmp[43];
        cube[213] = cube_tmp[49];
        cube[214] = cube_tmp[55];
        cube[215] = cube_tmp[61];
        cube[216] = cube_tmp[67];
        break;

    case threeBw_PRIME:
        cube[1] = cube_tmp[67];
        cube[2] = cube_tmp[61];
        cube[3] = cube_tmp[55];
        cube[4] = cube_tmp[49];
        cube[5] = cube_tmp[43];
        cube[6] = cube_tmp[37];
        cube[7] = cube_tmp[68];
        cube[8] = cube_tmp[62];
        cube[9] = cube_tmp[56];
        cube[10] = cube_tmp[50];
        cube[11] = cube_tmp[44];
        cube[12] = cube_tmp[38];
        cube[13] = cube_tmp[69];
        cube[14] = cube_tmp[63];
        cube[15] = cube_tmp[57];
        cube[16] = cube_tmp[51];
        cube[17] = cube_tmp[45];
        cube[18] = cube_tmp[39];
        cube[37] = cube_tmp[211];
        cube[38] = cube_tmp[205];
        cube[39] = cube_tmp[199];
        cube[43] = cube_tmp[212];
        cube[44] = cube_tmp[206];
        cube[45] = cube_tmp[200];
        cube[49] = cube_tmp[213];
        cube[50] = cube_tmp[207];
        cube[51] = cube_tmp[201];
        cube[55] = cube_tmp[214];
        cube[56] = cube_tmp[208];
        cube[57] = cube_tmp[202];
        cube[61] = cube_tmp[215];
        cube[62] = cube_tmp[209];
        cube[63] = cube_tmp[203];
        cube[67] = cube_tmp[216];
        cube[68] = cube_tmp[210];
        cube[69] = cube_tmp[204];
        cube[112] = cube_tmp[13];
        cube[113] = cube_tmp[7];
        cube[114] = cube_tmp[1];
        cube[118] = cube_tmp[14];
        cube[119] = cube_tmp[8];
        cube[120] = cube_tmp[2];
        cube[124] = cube_tmp[15];
        cube[125] = cube_tmp[9];
        cube[126] = cube_tmp[3];
        cube[130] = cube_tmp[16];
        cube[131] = cube_tmp[10];
        cube[132] = cube_tmp[4];
        cube[136] = cube_tmp[17];
        cube[137] = cube_tmp[11];
        cube[138] = cube_tmp[5];
        cube[142] = cube_tmp[18];
        cube[143] = cube_tmp[12];
        cube[144] = cube_tmp[6];
        cube[145] = cube_tmp[150];
        cube[146] = cube_tmp[156];
        cube[147] = cube_tmp[162];
        cube[148] = cube_tmp[168];
        cube[149] = cube_tmp[174];
        cube[150] = cube_tmp[180];
        cube[151] = cube_tmp[149];
        cube[152] = cube_tmp[155];
        cube[153] = cube_tmp[161];
        cube[154] = cube_tmp[167];
        cube[155] = cube_tmp[173];
        cube[156] = cube_tmp[179];
        cube[157] = cube_tmp[148];
        cube[158] = cube_tmp[154];
        cube[159] = cube_tmp[160];
        cube[160] = cube_tmp[166];
        cube[161] = cube_tmp[172];
        cube[162] = cube_tmp[178];
        cube[163] = cube_tmp[147];
        cube[164] = cube_tmp[153];
        cube[165] = cube_tmp[159];
        cube[166] = cube_tmp[165];
        cube[167] = cube_tmp[171];
        cube[168] = cube_tmp[177];
        cube[169] = cube_tmp[146];
        cube[170] = cube_tmp[152];
        cube[171] = cube_tmp[158];
        cube[172] = cube_tmp[164];
        cube[173] = cube_tmp[170];
        cube[174] = cube_tmp[176];
        cube[175] = cube_tmp[145];
        cube[176] = cube_tmp[151];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[163];
        cube[179] = cube_tmp[169];
        cube[180] = cube_tmp[175];
        cube[199] = cube_tmp[142];
        cube[200] = cube_tmp[136];
        cube[201] = cube_tmp[130];
        cube[202] = cube_tmp[124];
        cube[203] = cube_tmp[118];
        cube[204] = cube_tmp[112];
        cube[205] = cube_tmp[143];
        cube[206] = cube_tmp[137];
        cube[207] = cube_tmp[131];
        cube[208] = cube_tmp[125];
        cube[209] = cube_tmp[119];
        cube[210] = cube_tmp[113];
        cube[211] = cube_tmp[144];
        cube[212] = cube_tmp[138];
        cube[213] = cube_tmp[132];
        cube[214] = cube_tmp[126];
        cube[215] = cube_tmp[120];
        cube[216] = cube_tmp[114];
        break;

    case threeBw2:
        cube[1] = cube_tmp[216];
        cube[2] = cube_tmp[215];
        cube[3] = cube_tmp[214];
        cube[4] = cube_tmp[213];
        cube[5] = cube_tmp[212];
        cube[6] = cube_tmp[211];
        cube[7] = cube_tmp[210];
        cube[8] = cube_tmp[209];
        cube[9] = cube_tmp[208];
        cube[10] = cube_tmp[207];
        cube[11] = cube_tmp[206];
        cube[12] = cube_tmp[205];
        cube[13] = cube_tmp[204];
        cube[14] = cube_tmp[203];
        cube[15] = cube_tmp[202];
        cube[16] = cube_tmp[201];
        cube[17] = cube_tmp[200];
        cube[18] = cube_tmp[199];
        cube[37] = cube_tmp[144];
        cube[38] = cube_tmp[143];
        cube[39] = cube_tmp[142];
        cube[43] = cube_tmp[138];
        cube[44] = cube_tmp[137];
        cube[45] = cube_tmp[136];
        cube[49] = cube_tmp[132];
        cube[50] = cube_tmp[131];
        cube[51] = cube_tmp[130];
        cube[55] = cube_tmp[126];
        cube[56] = cube_tmp[125];
        cube[57] = cube_tmp[124];
        cube[61] = cube_tmp[120];
        cube[62] = cube_tmp[119];
        cube[63] = cube_tmp[118];
        cube[67] = cube_tmp[114];
        cube[68] = cube_tmp[113];
        cube[69] = cube_tmp[112];
        cube[112] = cube_tmp[69];
        cube[113] = cube_tmp[68];
        cube[114] = cube_tmp[67];
        cube[118] = cube_tmp[63];
        cube[119] = cube_tmp[62];
        cube[120] = cube_tmp[61];
        cube[124] = cube_tmp[57];
        cube[125] = cube_tmp[56];
        cube[126] = cube_tmp[55];
        cube[130] = cube_tmp[51];
        cube[131] = cube_tmp[50];
        cube[132] = cube_tmp[49];
        cube[136] = cube_tmp[45];
        cube[137] = cube_tmp[44];
        cube[138] = cube_tmp[43];
        cube[142] = cube_tmp[39];
        cube[143] = cube_tmp[38];
        cube[144] = cube_tmp[37];
        cube[145] = cube_tmp[180];
        cube[146] = cube_tmp[179];
        cube[147] = cube_tmp[178];
        cube[148] = cube_tmp[177];
        cube[149] = cube_tmp[176];
        cube[150] = cube_tmp[175];
        cube[151] = cube_tmp[174];
        cube[152] = cube_tmp[173];
        cube[153] = cube_tmp[172];
        cube[154] = cube_tmp[171];
        cube[155] = cube_tmp[170];
        cube[156] = cube_tmp[169];
        cube[157] = cube_tmp[168];
        cube[158] = cube_tmp[167];
        cube[159] = cube_tmp[166];
        cube[160] = cube_tmp[165];
        cube[161] = cube_tmp[164];
        cube[162] = cube_tmp[163];
        cube[163] = cube_tmp[162];
        cube[164] = cube_tmp[161];
        cube[165] = cube_tmp[160];
        cube[166] = cube_tmp[159];
        cube[167] = cube_tmp[158];
        cube[168] = cube_tmp[157];
        cube[169] = cube_tmp[156];
        cube[170] = cube_tmp[155];
        cube[171] = cube_tmp[154];
        cube[172] = cube_tmp[153];
        cube[173] = cube_tmp[152];
        cube[174] = cube_tmp[151];
        cube[175] = cube_tmp[150];
        cube[176] = cube_tmp[149];
        cube[177] = cube_tmp[148];
        cube[178] = cube_tmp[147];
        cube[179] = cube_tmp[146];
        cube[180] = cube_tmp[145];
        cube[199] = cube_tmp[18];
        cube[200] = cube_tmp[17];
        cube[201] = cube_tmp[16];
        cube[202] = cube_tmp[15];
        cube[203] = cube_tmp[14];
        cube[204] = cube_tmp[13];
        cube[205] = cube_tmp[12];
        cube[206] = cube_tmp[11];
        cube[207] = cube_tmp[10];
        cube[208] = cube_tmp[9];
        cube[209] = cube_tmp[8];
        cube[210] = cube_tmp[7];
        cube[211] = cube_tmp[6];
        cube[212] = cube_tmp[5];
        cube[213] = cube_tmp[4];
        cube[214] = cube_tmp[3];
        cube[215] = cube_tmp[2];
        cube[216] = cube_tmp[1];
        break;

    case D:
        cube[67] = cube_tmp[175];
        cube[68] = cube_tmp[176];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[178];
        cube[71] = cube_tmp[179];
        cube[72] = cube_tmp[180];
        cube[103] = cube_tmp[67];
        cube[104] = cube_tmp[68];
        cube[105] = cube_tmp[69];
        cube[106] = cube_tmp[70];
        cube[107] = cube_tmp[71];
        cube[108] = cube_tmp[72];
        cube[139] = cube_tmp[103];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[107];
        cube[144] = cube_tmp[108];
        cube[175] = cube_tmp[139];
        cube[176] = cube_tmp[140];
        cube[177] = cube_tmp[141];
        cube[178] = cube_tmp[142];
        cube[179] = cube_tmp[143];
        cube[180] = cube_tmp[144];
        cube[181] = cube_tmp[211];
        cube[182] = cube_tmp[205];
        cube[183] = cube_tmp[199];
        cube[184] = cube_tmp[193];
        cube[185] = cube_tmp[187];
        cube[186] = cube_tmp[181];
        cube[187] = cube_tmp[212];
        cube[188] = cube_tmp[206];
        cube[189] = cube_tmp[200];
        cube[190] = cube_tmp[194];
        cube[191] = cube_tmp[188];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[213];
        cube[194] = cube_tmp[207];
        cube[195] = cube_tmp[201];
        cube[196] = cube_tmp[195];
        cube[197] = cube_tmp[189];
        cube[198] = cube_tmp[183];
        cube[199] = cube_tmp[214];
        cube[200] = cube_tmp[208];
        cube[201] = cube_tmp[202];
        cube[202] = cube_tmp[196];
        cube[203] = cube_tmp[190];
        cube[204] = cube_tmp[184];
        cube[205] = cube_tmp[215];
        cube[206] = cube_tmp[209];
        cube[207] = cube_tmp[203];
        cube[208] = cube_tmp[197];
        cube[209] = cube_tmp[191];
        cube[210] = cube_tmp[185];
        cube[211] = cube_tmp[216];
        cube[212] = cube_tmp[210];
        cube[213] = cube_tmp[204];
        cube[214] = cube_tmp[198];
        cube[215] = cube_tmp[192];
        cube[216] = cube_tmp[186];
        break;

    case D_PRIME:
        cube[67] = cube_tmp[103];
        cube[68] = cube_tmp[104];
        cube[69] = cube_tmp[105];
        cube[70] = cube_tmp[106];
        cube[71] = cube_tmp[107];
        cube[72] = cube_tmp[108];
        cube[103] = cube_tmp[139];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[143];
        cube[108] = cube_tmp[144];
        cube[139] = cube_tmp[175];
        cube[140] = cube_tmp[176];
        cube[141] = cube_tmp[177];
        cube[142] = cube_tmp[178];
        cube[143] = cube_tmp[179];
        cube[144] = cube_tmp[180];
        cube[175] = cube_tmp[67];
        cube[176] = cube_tmp[68];
        cube[177] = cube_tmp[69];
        cube[178] = cube_tmp[70];
        cube[179] = cube_tmp[71];
        cube[180] = cube_tmp[72];
        cube[181] = cube_tmp[186];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[198];
        cube[184] = cube_tmp[204];
        cube[185] = cube_tmp[210];
        cube[186] = cube_tmp[216];
        cube[187] = cube_tmp[185];
        cube[188] = cube_tmp[191];
        cube[189] = cube_tmp[197];
        cube[190] = cube_tmp[203];
        cube[191] = cube_tmp[209];
        cube[192] = cube_tmp[215];
        cube[193] = cube_tmp[184];
        cube[194] = cube_tmp[190];
        cube[195] = cube_tmp[196];
        cube[196] = cube_tmp[202];
        cube[197] = cube_tmp[208];
        cube[198] = cube_tmp[214];
        cube[199] = cube_tmp[183];
        cube[200] = cube_tmp[189];
        cube[201] = cube_tmp[195];
        cube[202] = cube_tmp[201];
        cube[203] = cube_tmp[207];
        cube[204] = cube_tmp[213];
        cube[205] = cube_tmp[182];
        cube[206] = cube_tmp[188];
        cube[207] = cube_tmp[194];
        cube[208] = cube_tmp[200];
        cube[209] = cube_tmp[206];
        cube[210] = cube_tmp[212];
        cube[211] = cube_tmp[181];
        cube[212] = cube_tmp[187];
        cube[213] = cube_tmp[193];
        cube[214] = cube_tmp[199];
        cube[215] = cube_tmp[205];
        cube[216] = cube_tmp[211];
        break;

    case D2:
        cube[67] = cube_tmp[139];
        cube[68] = cube_tmp[140];
        cube[69] = cube_tmp[141];
        cube[70] = cube_tmp[142];
        cube[71] = cube_tmp[143];
        cube[72] = cube_tmp[144];
        cube[103] = cube_tmp[175];
        cube[104] = cube_tmp[176];
        cube[105] = cube_tmp[177];
        cube[106] = cube_tmp[178];
        cube[107] = cube_tmp[179];
        cube[108] = cube_tmp[180];
        cube[139] = cube_tmp[67];
        cube[140] = cube_tmp[68];
        cube[141] = cube_tmp[69];
        cube[142] = cube_tmp[70];
        cube[143] = cube_tmp[71];
        cube[144] = cube_tmp[72];
        cube[175] = cube_tmp[103];
        cube[176] = cube_tmp[104];
        cube[177] = cube_tmp[105];
        cube[178] = cube_tmp[106];
        cube[179] = cube_tmp[107];
        cube[180] = cube_tmp[108];
        cube[181] = cube_tmp[216];
        cube[182] = cube_tmp[215];
        cube[183] = cube_tmp[214];
        cube[184] = cube_tmp[213];
        cube[185] = cube_tmp[212];
        cube[186] = cube_tmp[211];
        cube[187] = cube_tmp[210];
        cube[188] = cube_tmp[209];
        cube[189] = cube_tmp[208];
        cube[190] = cube_tmp[207];
        cube[191] = cube_tmp[206];
        cube[192] = cube_tmp[205];
        cube[193] = cube_tmp[204];
        cube[194] = cube_tmp[203];
        cube[195] = cube_tmp[202];
        cube[196] = cube_tmp[201];
        cube[197] = cube_tmp[200];
        cube[198] = cube_tmp[199];
        cube[199] = cube_tmp[198];
        cube[200] = cube_tmp[197];
        cube[201] = cube_tmp[196];
        cube[202] = cube_tmp[195];
        cube[203] = cube_tmp[194];
        cube[204] = cube_tmp[193];
        cube[205] = cube_tmp[192];
        cube[206] = cube_tmp[191];
        cube[207] = cube_tmp[190];
        cube[208] = cube_tmp[189];
        cube[209] = cube_tmp[188];
        cube[210] = cube_tmp[187];
        cube[211] = cube_tmp[186];
        cube[212] = cube_tmp[185];
        cube[213] = cube_tmp[184];
        cube[214] = cube_tmp[183];
        cube[215] = cube_tmp[182];
        cube[216] = cube_tmp[181];
        break;

    case Dw:
        cube[61] = cube_tmp[169];
        cube[62] = cube_tmp[170];
        cube[63] = cube_tmp[171];
        cube[64] = cube_tmp[172];
        cube[65] = cube_tmp[173];
        cube[66] = cube_tmp[174];
        cube[67] = cube_tmp[175];
        cube[68] = cube_tmp[176];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[178];
        cube[71] = cube_tmp[179];
        cube[72] = cube_tmp[180];
        cube[97] = cube_tmp[61];
        cube[98] = cube_tmp[62];
        cube[99] = cube_tmp[63];
        cube[100] = cube_tmp[64];
        cube[101] = cube_tmp[65];
        cube[102] = cube_tmp[66];
        cube[103] = cube_tmp[67];
        cube[104] = cube_tmp[68];
        cube[105] = cube_tmp[69];
        cube[106] = cube_tmp[70];
        cube[107] = cube_tmp[71];
        cube[108] = cube_tmp[72];
        cube[133] = cube_tmp[97];
        cube[134] = cube_tmp[98];
        cube[135] = cube_tmp[99];
        cube[136] = cube_tmp[100];
        cube[137] = cube_tmp[101];
        cube[138] = cube_tmp[102];
        cube[139] = cube_tmp[103];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[107];
        cube[144] = cube_tmp[108];
        cube[169] = cube_tmp[133];
        cube[170] = cube_tmp[134];
        cube[171] = cube_tmp[135];
        cube[172] = cube_tmp[136];
        cube[173] = cube_tmp[137];
        cube[174] = cube_tmp[138];
        cube[175] = cube_tmp[139];
        cube[176] = cube_tmp[140];
        cube[177] = cube_tmp[141];
        cube[178] = cube_tmp[142];
        cube[179] = cube_tmp[143];
        cube[180] = cube_tmp[144];
        cube[181] = cube_tmp[211];
        cube[182] = cube_tmp[205];
        cube[183] = cube_tmp[199];
        cube[184] = cube_tmp[193];
        cube[185] = cube_tmp[187];
        cube[186] = cube_tmp[181];
        cube[187] = cube_tmp[212];
        cube[188] = cube_tmp[206];
        cube[189] = cube_tmp[200];
        cube[190] = cube_tmp[194];
        cube[191] = cube_tmp[188];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[213];
        cube[194] = cube_tmp[207];
        cube[195] = cube_tmp[201];
        cube[196] = cube_tmp[195];
        cube[197] = cube_tmp[189];
        cube[198] = cube_tmp[183];
        cube[199] = cube_tmp[214];
        cube[200] = cube_tmp[208];
        cube[201] = cube_tmp[202];
        cube[202] = cube_tmp[196];
        cube[203] = cube_tmp[190];
        cube[204] = cube_tmp[184];
        cube[205] = cube_tmp[215];
        cube[206] = cube_tmp[209];
        cube[207] = cube_tmp[203];
        cube[208] = cube_tmp[197];
        cube[209] = cube_tmp[191];
        cube[210] = cube_tmp[185];
        cube[211] = cube_tmp[216];
        cube[212] = cube_tmp[210];
        cube[213] = cube_tmp[204];
        cube[214] = cube_tmp[198];
        cube[215] = cube_tmp[192];
        cube[216] = cube_tmp[186];
        break;

    case Dw_PRIME:
        cube[61] = cube_tmp[97];
        cube[62] = cube_tmp[98];
        cube[63] = cube_tmp[99];
        cube[64] = cube_tmp[100];
        cube[65] = cube_tmp[101];
        cube[66] = cube_tmp[102];
        cube[67] = cube_tmp[103];
        cube[68] = cube_tmp[104];
        cube[69] = cube_tmp[105];
        cube[70] = cube_tmp[106];
        cube[71] = cube_tmp[107];
        cube[72] = cube_tmp[108];
        cube[97] = cube_tmp[133];
        cube[98] = cube_tmp[134];
        cube[99] = cube_tmp[135];
        cube[100] = cube_tmp[136];
        cube[101] = cube_tmp[137];
        cube[102] = cube_tmp[138];
        cube[103] = cube_tmp[139];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[143];
        cube[108] = cube_tmp[144];
        cube[133] = cube_tmp[169];
        cube[134] = cube_tmp[170];
        cube[135] = cube_tmp[171];
        cube[136] = cube_tmp[172];
        cube[137] = cube_tmp[173];
        cube[138] = cube_tmp[174];
        cube[139] = cube_tmp[175];
        cube[140] = cube_tmp[176];
        cube[141] = cube_tmp[177];
        cube[142] = cube_tmp[178];
        cube[143] = cube_tmp[179];
        cube[144] = cube_tmp[180];
        cube[169] = cube_tmp[61];
        cube[170] = cube_tmp[62];
        cube[171] = cube_tmp[63];
        cube[172] = cube_tmp[64];
        cube[173] = cube_tmp[65];
        cube[174] = cube_tmp[66];
        cube[175] = cube_tmp[67];
        cube[176] = cube_tmp[68];
        cube[177] = cube_tmp[69];
        cube[178] = cube_tmp[70];
        cube[179] = cube_tmp[71];
        cube[180] = cube_tmp[72];
        cube[181] = cube_tmp[186];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[198];
        cube[184] = cube_tmp[204];
        cube[185] = cube_tmp[210];
        cube[186] = cube_tmp[216];
        cube[187] = cube_tmp[185];
        cube[188] = cube_tmp[191];
        cube[189] = cube_tmp[197];
        cube[190] = cube_tmp[203];
        cube[191] = cube_tmp[209];
        cube[192] = cube_tmp[215];
        cube[193] = cube_tmp[184];
        cube[194] = cube_tmp[190];
        cube[195] = cube_tmp[196];
        cube[196] = cube_tmp[202];
        cube[197] = cube_tmp[208];
        cube[198] = cube_tmp[214];
        cube[199] = cube_tmp[183];
        cube[200] = cube_tmp[189];
        cube[201] = cube_tmp[195];
        cube[202] = cube_tmp[201];
        cube[203] = cube_tmp[207];
        cube[204] = cube_tmp[213];
        cube[205] = cube_tmp[182];
        cube[206] = cube_tmp[188];
        cube[207] = cube_tmp[194];
        cube[208] = cube_tmp[200];
        cube[209] = cube_tmp[206];
        cube[210] = cube_tmp[212];
        cube[211] = cube_tmp[181];
        cube[212] = cube_tmp[187];
        cube[213] = cube_tmp[193];
        cube[214] = cube_tmp[199];
        cube[215] = cube_tmp[205];
        cube[216] = cube_tmp[211];
        break;

    case Dw2:
        cube[61] = cube_tmp[133];
        cube[62] = cube_tmp[134];
        cube[63] = cube_tmp[135];
        cube[64] = cube_tmp[136];
        cube[65] = cube_tmp[137];
        cube[66] = cube_tmp[138];
        cube[67] = cube_tmp[139];
        cube[68] = cube_tmp[140];
        cube[69] = cube_tmp[141];
        cube[70] = cube_tmp[142];
        cube[71] = cube_tmp[143];
        cube[72] = cube_tmp[144];
        cube[97] = cube_tmp[169];
        cube[98] = cube_tmp[170];
        cube[99] = cube_tmp[171];
        cube[100] = cube_tmp[172];
        cube[101] = cube_tmp[173];
        cube[102] = cube_tmp[174];
        cube[103] = cube_tmp[175];
        cube[104] = cube_tmp[176];
        cube[105] = cube_tmp[177];
        cube[106] = cube_tmp[178];
        cube[107] = cube_tmp[179];
        cube[108] = cube_tmp[180];
        cube[133] = cube_tmp[61];
        cube[134] = cube_tmp[62];
        cube[135] = cube_tmp[63];
        cube[136] = cube_tmp[64];
        cube[137] = cube_tmp[65];
        cube[138] = cube_tmp[66];
        cube[139] = cube_tmp[67];
        cube[140] = cube_tmp[68];
        cube[141] = cube_tmp[69];
        cube[142] = cube_tmp[70];
        cube[143] = cube_tmp[71];
        cube[144] = cube_tmp[72];
        cube[169] = cube_tmp[97];
        cube[170] = cube_tmp[98];
        cube[171] = cube_tmp[99];
        cube[172] = cube_tmp[100];
        cube[173] = cube_tmp[101];
        cube[174] = cube_tmp[102];
        cube[175] = cube_tmp[103];
        cube[176] = cube_tmp[104];
        cube[177] = cube_tmp[105];
        cube[178] = cube_tmp[106];
        cube[179] = cube_tmp[107];
        cube[180] = cube_tmp[108];
        cube[181] = cube_tmp[216];
        cube[182] = cube_tmp[215];
        cube[183] = cube_tmp[214];
        cube[184] = cube_tmp[213];
        cube[185] = cube_tmp[212];
        cube[186] = cube_tmp[211];
        cube[187] = cube_tmp[210];
        cube[188] = cube_tmp[209];
        cube[189] = cube_tmp[208];
        cube[190] = cube_tmp[207];
        cube[191] = cube_tmp[206];
        cube[192] = cube_tmp[205];
        cube[193] = cube_tmp[204];
        cube[194] = cube_tmp[203];
        cube[195] = cube_tmp[202];
        cube[196] = cube_tmp[201];
        cube[197] = cube_tmp[200];
        cube[198] = cube_tmp[199];
        cube[199] = cube_tmp[198];
        cube[200] = cube_tmp[197];
        cube[201] = cube_tmp[196];
        cube[202] = cube_tmp[195];
        cube[203] = cube_tmp[194];
        cube[204] = cube_tmp[193];
        cube[205] = cube_tmp[192];
        cube[206] = cube_tmp[191];
        cube[207] = cube_tmp[190];
        cube[208] = cube_tmp[189];
        cube[209] = cube_tmp[188];
        cube[210] = cube_tmp[187];
        cube[211] = cube_tmp[186];
        cube[212] = cube_tmp[185];
        cube[213] = cube_tmp[184];
        cube[214] = cube_tmp[183];
        cube[215] = cube_tmp[182];
        cube[216] = cube_tmp[181];
        break;

    case threeDw:
        cube[55] = cube_tmp[163];
        cube[56] = cube_tmp[164];
        cube[57] = cube_tmp[165];
        cube[58] = cube_tmp[166];
        cube[59] = cube_tmp[167];
        cube[60] = cube_tmp[168];
        cube[61] = cube_tmp[169];
        cube[62] = cube_tmp[170];
        cube[63] = cube_tmp[171];
        cube[64] = cube_tmp[172];
        cube[65] = cube_tmp[173];
        cube[66] = cube_tmp[174];
        cube[67] = cube_tmp[175];
        cube[68] = cube_tmp[176];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[178];
        cube[71] = cube_tmp[179];
        cube[72] = cube_tmp[180];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[56];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[58];
        cube[95] = cube_tmp[59];
        cube[96] = cube_tmp[60];
        cube[97] = cube_tmp[61];
        cube[98] = cube_tmp[62];
        cube[99] = cube_tmp[63];
        cube[100] = cube_tmp[64];
        cube[101] = cube_tmp[65];
        cube[102] = cube_tmp[66];
        cube[103] = cube_tmp[67];
        cube[104] = cube_tmp[68];
        cube[105] = cube_tmp[69];
        cube[106] = cube_tmp[70];
        cube[107] = cube_tmp[71];
        cube[108] = cube_tmp[72];
        cube[127] = cube_tmp[91];
        cube[128] = cube_tmp[92];
        cube[129] = cube_tmp[93];
        cube[130] = cube_tmp[94];
        cube[131] = cube_tmp[95];
        cube[132] = cube_tmp[96];
        cube[133] = cube_tmp[97];
        cube[134] = cube_tmp[98];
        cube[135] = cube_tmp[99];
        cube[136] = cube_tmp[100];
        cube[137] = cube_tmp[101];
        cube[138] = cube_tmp[102];
        cube[139] = cube_tmp[103];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[107];
        cube[144] = cube_tmp[108];
        cube[163] = cube_tmp[127];
        cube[164] = cube_tmp[128];
        cube[165] = cube_tmp[129];
        cube[166] = cube_tmp[130];
        cube[167] = cube_tmp[131];
        cube[168] = cube_tmp[132];
        cube[169] = cube_tmp[133];
        cube[170] = cube_tmp[134];
        cube[171] = cube_tmp[135];
        cube[172] = cube_tmp[136];
        cube[173] = cube_tmp[137];
        cube[174] = cube_tmp[138];
        cube[175] = cube_tmp[139];
        cube[176] = cube_tmp[140];
        cube[177] = cube_tmp[141];
        cube[178] = cube_tmp[142];
        cube[179] = cube_tmp[143];
        cube[180] = cube_tmp[144];
        cube[181] = cube_tmp[211];
        cube[182] = cube_tmp[205];
        cube[183] = cube_tmp[199];
        cube[184] = cube_tmp[193];
        cube[185] = cube_tmp[187];
        cube[186] = cube_tmp[181];
        cube[187] = cube_tmp[212];
        cube[188] = cube_tmp[206];
        cube[189] = cube_tmp[200];
        cube[190] = cube_tmp[194];
        cube[191] = cube_tmp[188];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[213];
        cube[194] = cube_tmp[207];
        cube[195] = cube_tmp[201];
        cube[196] = cube_tmp[195];
        cube[197] = cube_tmp[189];
        cube[198] = cube_tmp[183];
        cube[199] = cube_tmp[214];
        cube[200] = cube_tmp[208];
        cube[201] = cube_tmp[202];
        cube[202] = cube_tmp[196];
        cube[203] = cube_tmp[190];
        cube[204] = cube_tmp[184];
        cube[205] = cube_tmp[215];
        cube[206] = cube_tmp[209];
        cube[207] = cube_tmp[203];
        cube[208] = cube_tmp[197];
        cube[209] = cube_tmp[191];
        cube[210] = cube_tmp[185];
        cube[211] = cube_tmp[216];
        cube[212] = cube_tmp[210];
        cube[213] = cube_tmp[204];
        cube[214] = cube_tmp[198];
        cube[215] = cube_tmp[192];
        cube[216] = cube_tmp[186];
        break;

    case threeDw_PRIME:
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[92];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[94];
        cube[59] = cube_tmp[95];
        cube[60] = cube_tmp[96];
        cube[61] = cube_tmp[97];
        cube[62] = cube_tmp[98];
        cube[63] = cube_tmp[99];
        cube[64] = cube_tmp[100];
        cube[65] = cube_tmp[101];
        cube[66] = cube_tmp[102];
        cube[67] = cube_tmp[103];
        cube[68] = cube_tmp[104];
        cube[69] = cube_tmp[105];
        cube[70] = cube_tmp[106];
        cube[71] = cube_tmp[107];
        cube[72] = cube_tmp[108];
        cube[91] = cube_tmp[127];
        cube[92] = cube_tmp[128];
        cube[93] = cube_tmp[129];
        cube[94] = cube_tmp[130];
        cube[95] = cube_tmp[131];
        cube[96] = cube_tmp[132];
        cube[97] = cube_tmp[133];
        cube[98] = cube_tmp[134];
        cube[99] = cube_tmp[135];
        cube[100] = cube_tmp[136];
        cube[101] = cube_tmp[137];
        cube[102] = cube_tmp[138];
        cube[103] = cube_tmp[139];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[143];
        cube[108] = cube_tmp[144];
        cube[127] = cube_tmp[163];
        cube[128] = cube_tmp[164];
        cube[129] = cube_tmp[165];
        cube[130] = cube_tmp[166];
        cube[131] = cube_tmp[167];
        cube[132] = cube_tmp[168];
        cube[133] = cube_tmp[169];
        cube[134] = cube_tmp[170];
        cube[135] = cube_tmp[171];
        cube[136] = cube_tmp[172];
        cube[137] = cube_tmp[173];
        cube[138] = cube_tmp[174];
        cube[139] = cube_tmp[175];
        cube[140] = cube_tmp[176];
        cube[141] = cube_tmp[177];
        cube[142] = cube_tmp[178];
        cube[143] = cube_tmp[179];
        cube[144] = cube_tmp[180];
        cube[163] = cube_tmp[55];
        cube[164] = cube_tmp[56];
        cube[165] = cube_tmp[57];
        cube[166] = cube_tmp[58];
        cube[167] = cube_tmp[59];
        cube[168] = cube_tmp[60];
        cube[169] = cube_tmp[61];
        cube[170] = cube_tmp[62];
        cube[171] = cube_tmp[63];
        cube[172] = cube_tmp[64];
        cube[173] = cube_tmp[65];
        cube[174] = cube_tmp[66];
        cube[175] = cube_tmp[67];
        cube[176] = cube_tmp[68];
        cube[177] = cube_tmp[69];
        cube[178] = cube_tmp[70];
        cube[179] = cube_tmp[71];
        cube[180] = cube_tmp[72];
        cube[181] = cube_tmp[186];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[198];
        cube[184] = cube_tmp[204];
        cube[185] = cube_tmp[210];
        cube[186] = cube_tmp[216];
        cube[187] = cube_tmp[185];
        cube[188] = cube_tmp[191];
        cube[189] = cube_tmp[197];
        cube[190] = cube_tmp[203];
        cube[191] = cube_tmp[209];
        cube[192] = cube_tmp[215];
        cube[193] = cube_tmp[184];
        cube[194] = cube_tmp[190];
        cube[195] = cube_tmp[196];
        cube[196] = cube_tmp[202];
        cube[197] = cube_tmp[208];
        cube[198] = cube_tmp[214];
        cube[199] = cube_tmp[183];
        cube[200] = cube_tmp[189];
        cube[201] = cube_tmp[195];
        cube[202] = cube_tmp[201];
        cube[203] = cube_tmp[207];
        cube[204] = cube_tmp[213];
        cube[205] = cube_tmp[182];
        cube[206] = cube_tmp[188];
        cube[207] = cube_tmp[194];
        cube[208] = cube_tmp[200];
        cube[209] = cube_tmp[206];
        cube[210] = cube_tmp[212];
        cube[211] = cube_tmp[181];
        cube[212] = cube_tmp[187];
        cube[213] = cube_tmp[193];
        cube[214] = cube_tmp[199];
        cube[215] = cube_tmp[205];
        cube[216] = cube_tmp[211];
        break;

    case threeDw2:
        cube[55] = cube_tmp[127];
        cube[56] = cube_tmp[128];
        cube[57] = cube_tmp[129];
        cube[58] = cube_tmp[130];
        cube[59] = cube_tmp[131];
        cube[60] = cube_tmp[132];
        cube[61] = cube_tmp[133];
        cube[62] = cube_tmp[134];
        cube[63] = cube_tmp[135];
        cube[64] = cube_tmp[136];
        cube[65] = cube_tmp[137];
        cube[66] = cube_tmp[138];
        cube[67] = cube_tmp[139];
        cube[68] = cube_tmp[140];
        cube[69] = cube_tmp[141];
        cube[70] = cube_tmp[142];
        cube[71] = cube_tmp[143];
        cube[72] = cube_tmp[144];
        cube[91] = cube_tmp[163];
        cube[92] = cube_tmp[164];
        cube[93] = cube_tmp[165];
        cube[94] = cube_tmp[166];
        cube[95] = cube_tmp[167];
        cube[96] = cube_tmp[168];
        cube[97] = cube_tmp[169];
        cube[98] = cube_tmp[170];
        cube[99] = cube_tmp[171];
        cube[100] = cube_tmp[172];
        cube[101] = cube_tmp[173];
        cube[102] = cube_tmp[174];
        cube[103] = cube_tmp[175];
        cube[104] = cube_tmp[176];
        cube[105] = cube_tmp[177];
        cube[106] = cube_tmp[178];
        cube[107] = cube_tmp[179];
        cube[108] = cube_tmp[180];
        cube[127] = cube_tmp[55];
        cube[128] = cube_tmp[56];
        cube[129] = cube_tmp[57];
        cube[130] = cube_tmp[58];
        cube[131] = cube_tmp[59];
        cube[132] = cube_tmp[60];
        cube[133] = cube_tmp[61];
        cube[134] = cube_tmp[62];
        cube[135] = cube_tmp[63];
        cube[136] = cube_tmp[64];
        cube[137] = cube_tmp[65];
        cube[138] = cube_tmp[66];
        cube[139] = cube_tmp[67];
        cube[140] = cube_tmp[68];
        cube[141] = cube_tmp[69];
        cube[142] = cube_tmp[70];
        cube[143] = cube_tmp[71];
        cube[144] = cube_tmp[72];
        cube[163] = cube_tmp[91];
        cube[164] = cube_tmp[92];
        cube[165] = cube_tmp[93];
        cube[166] = cube_tmp[94];
        cube[167] = cube_tmp[95];
        cube[168] = cube_tmp[96];
        cube[169] = cube_tmp[97];
        cube[170] = cube_tmp[98];
        cube[171] = cube_tmp[99];
        cube[172] = cube_tmp[100];
        cube[173] = cube_tmp[101];
        cube[174] = cube_tmp[102];
        cube[175] = cube_tmp[103];
        cube[176] = cube_tmp[104];
        cube[177] = cube_tmp[105];
        cube[178] = cube_tmp[106];
        cube[179] = cube_tmp[107];
        cube[180] = cube_tmp[108];
        cube[181] = cube_tmp[216];
        cube[182] = cube_tmp[215];
        cube[183] = cube_tmp[214];
        cube[184] = cube_tmp[213];
        cube[185] = cube_tmp[212];
        cube[186] = cube_tmp[211];
        cube[187] = cube_tmp[210];
        cube[188] = cube_tmp[209];
        cube[189] = cube_tmp[208];
        cube[190] = cube_tmp[207];
        cube[191] = cube_tmp[206];
        cube[192] = cube_tmp[205];
        cube[193] = cube_tmp[204];
        cube[194] = cube_tmp[203];
        cube[195] = cube_tmp[202];
        cube[196] = cube_tmp[201];
        cube[197] = cube_tmp[200];
        cube[198] = cube_tmp[199];
        cube[199] = cube_tmp[198];
        cube[200] = cube_tmp[197];
        cube[201] = cube_tmp[196];
        cube[202] = cube_tmp[195];
        cube[203] = cube_tmp[194];
        cube[204] = cube_tmp[193];
        cube[205] = cube_tmp[192];
        cube[206] = cube_tmp[191];
        cube[207] = cube_tmp[190];
        cube[208] = cube_tmp[189];
        cube[209] = cube_tmp[188];
        cube[210] = cube_tmp[187];
        cube[211] = cube_tmp[186];
        cube[212] = cube_tmp[185];
        cube[213] = cube_tmp[184];
        cube[214] = cube_tmp[183];
        cube[215] = cube_tmp[182];
        cube[216] = cube_tmp[181];
        break;

    case X:
        cube[1] = cube_tmp[73];
        cube[2] = cube_tmp[74];
        cube[3] = cube_tmp[75];
        cube[4] = cube_tmp[76];
        cube[5] = cube_tmp[77];
        cube[6] = cube_tmp[78];
        cube[7] = cube_tmp[79];
        cube[8] = cube_tmp[80];
        cube[9] = cube_tmp[81];
        cube[10] = cube_tmp[82];
        cube[11] = cube_tmp[83];
        cube[12] = cube_tmp[84];
        cube[13] = cube_tmp[85];
        cube[14] = cube_tmp[86];
        cube[15] = cube_tmp[87];
        cube[16] = cube_tmp[88];
        cube[17] = cube_tmp[89];
        cube[18] = cube_tmp[90];
        cube[19] = cube_tmp[91];
        cube[20] = cube_tmp[92];
        cube[21] = cube_tmp[93];
        cube[22] = cube_tmp[94];
        cube[23] = cube_tmp[95];
        cube[24] = cube_tmp[96];
        cube[25] = cube_tmp[97];
        cube[26] = cube_tmp[98];
        cube[27] = cube_tmp[99];
        cube[28] = cube_tmp[100];
        cube[29] = cube_tmp[101];
        cube[30] = cube_tmp[102];
        cube[31] = cube_tmp[103];
        cube[32] = cube_tmp[104];
        cube[33] = cube_tmp[105];
        cube[34] = cube_tmp[106];
        cube[35] = cube_tmp[107];
        cube[36] = cube_tmp[108];
        cube[37] = cube_tmp[42];
        cube[38] = cube_tmp[48];
        cube[39] = cube_tmp[54];
        cube[40] = cube_tmp[60];
        cube[41] = cube_tmp[66];
        cube[42] = cube_tmp[72];
        cube[43] = cube_tmp[41];
        cube[44] = cube_tmp[47];
        cube[45] = cube_tmp[53];
        cube[46] = cube_tmp[59];
        cube[47] = cube_tmp[65];
        cube[48] = cube_tmp[71];
        cube[49] = cube_tmp[40];
        cube[50] = cube_tmp[46];
        cube[51] = cube_tmp[52];
        cube[52] = cube_tmp[58];
        cube[53] = cube_tmp[64];
        cube[54] = cube_tmp[70];
        cube[55] = cube_tmp[39];
        cube[56] = cube_tmp[45];
        cube[57] = cube_tmp[51];
        cube[58] = cube_tmp[57];
        cube[59] = cube_tmp[63];
        cube[60] = cube_tmp[69];
        cube[61] = cube_tmp[38];
        cube[62] = cube_tmp[44];
        cube[63] = cube_tmp[50];
        cube[64] = cube_tmp[56];
        cube[65] = cube_tmp[62];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[37];
        cube[68] = cube_tmp[43];
        cube[69] = cube_tmp[49];
        cube[70] = cube_tmp[55];
        cube[71] = cube_tmp[61];
        cube[72] = cube_tmp[67];
        cube[73] = cube_tmp[181];
        cube[74] = cube_tmp[182];
        cube[75] = cube_tmp[183];
        cube[76] = cube_tmp[184];
        cube[77] = cube_tmp[185];
        cube[78] = cube_tmp[186];
        cube[79] = cube_tmp[187];
        cube[80] = cube_tmp[188];
        cube[81] = cube_tmp[189];
        cube[82] = cube_tmp[190];
        cube[83] = cube_tmp[191];
        cube[84] = cube_tmp[192];
        cube[85] = cube_tmp[193];
        cube[86] = cube_tmp[194];
        cube[87] = cube_tmp[195];
        cube[88] = cube_tmp[196];
        cube[89] = cube_tmp[197];
        cube[90] = cube_tmp[198];
        cube[91] = cube_tmp[199];
        cube[92] = cube_tmp[200];
        cube[93] = cube_tmp[201];
        cube[94] = cube_tmp[202];
        cube[95] = cube_tmp[203];
        cube[96] = cube_tmp[204];
        cube[97] = cube_tmp[205];
        cube[98] = cube_tmp[206];
        cube[99] = cube_tmp[207];
        cube[100] = cube_tmp[208];
        cube[101] = cube_tmp[209];
        cube[102] = cube_tmp[210];
        cube[103] = cube_tmp[211];
        cube[104] = cube_tmp[212];
        cube[105] = cube_tmp[213];
        cube[106] = cube_tmp[214];
        cube[107] = cube_tmp[215];
        cube[108] = cube_tmp[216];
        cube[109] = cube_tmp[139];
        cube[110] = cube_tmp[133];
        cube[111] = cube_tmp[127];
        cube[112] = cube_tmp[121];
        cube[113] = cube_tmp[115];
        cube[114] = cube_tmp[109];
        cube[115] = cube_tmp[140];
        cube[116] = cube_tmp[134];
        cube[117] = cube_tmp[128];
        cube[118] = cube_tmp[122];
        cube[119] = cube_tmp[116];
        cube[120] = cube_tmp[110];
        cube[121] = cube_tmp[141];
        cube[122] = cube_tmp[135];
        cube[123] = cube_tmp[129];
        cube[124] = cube_tmp[123];
        cube[125] = cube_tmp[117];
        cube[126] = cube_tmp[111];
        cube[127] = cube_tmp[142];
        cube[128] = cube_tmp[136];
        cube[129] = cube_tmp[130];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[118];
        cube[132] = cube_tmp[112];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[137];
        cube[135] = cube_tmp[131];
        cube[136] = cube_tmp[125];
        cube[137] = cube_tmp[119];
        cube[138] = cube_tmp[113];
        cube[139] = cube_tmp[144];
        cube[140] = cube_tmp[138];
        cube[141] = cube_tmp[132];
        cube[142] = cube_tmp[126];
        cube[143] = cube_tmp[120];
        cube[144] = cube_tmp[114];
        cube[145] = cube_tmp[36];
        cube[146] = cube_tmp[35];
        cube[147] = cube_tmp[34];
        cube[148] = cube_tmp[33];
        cube[149] = cube_tmp[32];
        cube[150] = cube_tmp[31];
        cube[151] = cube_tmp[30];
        cube[152] = cube_tmp[29];
        cube[153] = cube_tmp[28];
        cube[154] = cube_tmp[27];
        cube[155] = cube_tmp[26];
        cube[156] = cube_tmp[25];
        cube[157] = cube_tmp[24];
        cube[158] = cube_tmp[23];
        cube[159] = cube_tmp[22];
        cube[160] = cube_tmp[21];
        cube[161] = cube_tmp[20];
        cube[162] = cube_tmp[19];
        cube[163] = cube_tmp[18];
        cube[164] = cube_tmp[17];
        cube[165] = cube_tmp[16];
        cube[166] = cube_tmp[15];
        cube[167] = cube_tmp[14];
        cube[168] = cube_tmp[13];
        cube[169] = cube_tmp[12];
        cube[170] = cube_tmp[11];
        cube[171] = cube_tmp[10];
        cube[172] = cube_tmp[9];
        cube[173] = cube_tmp[8];
        cube[174] = cube_tmp[7];
        cube[175] = cube_tmp[6];
        cube[176] = cube_tmp[5];
        cube[177] = cube_tmp[4];
        cube[178] = cube_tmp[3];
        cube[179] = cube_tmp[2];
        cube[180] = cube_tmp[1];
        cube[181] = cube_tmp[180];
        cube[182] = cube_tmp[179];
        cube[183] = cube_tmp[178];
        cube[184] = cube_tmp[177];
        cube[185] = cube_tmp[176];
        cube[186] = cube_tmp[175];
        cube[187] = cube_tmp[174];
        cube[188] = cube_tmp[173];
        cube[189] = cube_tmp[172];
        cube[190] = cube_tmp[171];
        cube[191] = cube_tmp[170];
        cube[192] = cube_tmp[169];
        cube[193] = cube_tmp[168];
        cube[194] = cube_tmp[167];
        cube[195] = cube_tmp[166];
        cube[196] = cube_tmp[165];
        cube[197] = cube_tmp[164];
        cube[198] = cube_tmp[163];
        cube[199] = cube_tmp[162];
        cube[200] = cube_tmp[161];
        cube[201] = cube_tmp[160];
        cube[202] = cube_tmp[159];
        cube[203] = cube_tmp[158];
        cube[204] = cube_tmp[157];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[155];
        cube[207] = cube_tmp[154];
        cube[208] = cube_tmp[153];
        cube[209] = cube_tmp[152];
        cube[210] = cube_tmp[151];
        cube[211] = cube_tmp[150];
        cube[212] = cube_tmp[149];
        cube[213] = cube_tmp[148];
        cube[214] = cube_tmp[147];
        cube[215] = cube_tmp[146];
        cube[216] = cube_tmp[145];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[180];
        cube[2] = cube_tmp[179];
        cube[3] = cube_tmp[178];
        cube[4] = cube_tmp[177];
        cube[5] = cube_tmp[176];
        cube[6] = cube_tmp[175];
        cube[7] = cube_tmp[174];
        cube[8] = cube_tmp[173];
        cube[9] = cube_tmp[172];
        cube[10] = cube_tmp[171];
        cube[11] = cube_tmp[170];
        cube[12] = cube_tmp[169];
        cube[13] = cube_tmp[168];
        cube[14] = cube_tmp[167];
        cube[15] = cube_tmp[166];
        cube[16] = cube_tmp[165];
        cube[17] = cube_tmp[164];
        cube[18] = cube_tmp[163];
        cube[19] = cube_tmp[162];
        cube[20] = cube_tmp[161];
        cube[21] = cube_tmp[160];
        cube[22] = cube_tmp[159];
        cube[23] = cube_tmp[158];
        cube[24] = cube_tmp[157];
        cube[25] = cube_tmp[156];
        cube[26] = cube_tmp[155];
        cube[27] = cube_tmp[154];
        cube[28] = cube_tmp[153];
        cube[29] = cube_tmp[152];
        cube[30] = cube_tmp[151];
        cube[31] = cube_tmp[150];
        cube[32] = cube_tmp[149];
        cube[33] = cube_tmp[148];
        cube[34] = cube_tmp[147];
        cube[35] = cube_tmp[146];
        cube[36] = cube_tmp[145];
        cube[37] = cube_tmp[67];
        cube[38] = cube_tmp[61];
        cube[39] = cube_tmp[55];
        cube[40] = cube_tmp[49];
        cube[41] = cube_tmp[43];
        cube[42] = cube_tmp[37];
        cube[43] = cube_tmp[68];
        cube[44] = cube_tmp[62];
        cube[45] = cube_tmp[56];
        cube[46] = cube_tmp[50];
        cube[47] = cube_tmp[44];
        cube[48] = cube_tmp[38];
        cube[49] = cube_tmp[69];
        cube[50] = cube_tmp[63];
        cube[51] = cube_tmp[57];
        cube[52] = cube_tmp[51];
        cube[53] = cube_tmp[45];
        cube[54] = cube_tmp[39];
        cube[55] = cube_tmp[70];
        cube[56] = cube_tmp[64];
        cube[57] = cube_tmp[58];
        cube[58] = cube_tmp[52];
        cube[59] = cube_tmp[46];
        cube[60] = cube_tmp[40];
        cube[61] = cube_tmp[71];
        cube[62] = cube_tmp[65];
        cube[63] = cube_tmp[59];
        cube[64] = cube_tmp[53];
        cube[65] = cube_tmp[47];
        cube[66] = cube_tmp[41];
        cube[67] = cube_tmp[72];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[60];
        cube[70] = cube_tmp[54];
        cube[71] = cube_tmp[48];
        cube[72] = cube_tmp[42];
        cube[73] = cube_tmp[1];
        cube[74] = cube_tmp[2];
        cube[75] = cube_tmp[3];
        cube[76] = cube_tmp[4];
        cube[77] = cube_tmp[5];
        cube[78] = cube_tmp[6];
        cube[79] = cube_tmp[7];
        cube[80] = cube_tmp[8];
        cube[81] = cube_tmp[9];
        cube[82] = cube_tmp[10];
        cube[83] = cube_tmp[11];
        cube[84] = cube_tmp[12];
        cube[85] = cube_tmp[13];
        cube[86] = cube_tmp[14];
        cube[87] = cube_tmp[15];
        cube[88] = cube_tmp[16];
        cube[89] = cube_tmp[17];
        cube[90] = cube_tmp[18];
        cube[91] = cube_tmp[19];
        cube[92] = cube_tmp[20];
        cube[93] = cube_tmp[21];
        cube[94] = cube_tmp[22];
        cube[95] = cube_tmp[23];
        cube[96] = cube_tmp[24];
        cube[97] = cube_tmp[25];
        cube[98] = cube_tmp[26];
        cube[99] = cube_tmp[27];
        cube[100] = cube_tmp[28];
        cube[101] = cube_tmp[29];
        cube[102] = cube_tmp[30];
        cube[103] = cube_tmp[31];
        cube[104] = cube_tmp[32];
        cube[105] = cube_tmp[33];
        cube[106] = cube_tmp[34];
        cube[107] = cube_tmp[35];
        cube[108] = cube_tmp[36];
        cube[109] = cube_tmp[114];
        cube[110] = cube_tmp[120];
        cube[111] = cube_tmp[126];
        cube[112] = cube_tmp[132];
        cube[113] = cube_tmp[138];
        cube[114] = cube_tmp[144];
        cube[115] = cube_tmp[113];
        cube[116] = cube_tmp[119];
        cube[117] = cube_tmp[125];
        cube[118] = cube_tmp[131];
        cube[119] = cube_tmp[137];
        cube[120] = cube_tmp[143];
        cube[121] = cube_tmp[112];
        cube[122] = cube_tmp[118];
        cube[123] = cube_tmp[124];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[136];
        cube[126] = cube_tmp[142];
        cube[127] = cube_tmp[111];
        cube[128] = cube_tmp[117];
        cube[129] = cube_tmp[123];
        cube[130] = cube_tmp[129];
        cube[131] = cube_tmp[135];
        cube[132] = cube_tmp[141];
        cube[133] = cube_tmp[110];
        cube[134] = cube_tmp[116];
        cube[135] = cube_tmp[122];
        cube[136] = cube_tmp[128];
        cube[137] = cube_tmp[134];
        cube[138] = cube_tmp[140];
        cube[139] = cube_tmp[109];
        cube[140] = cube_tmp[115];
        cube[141] = cube_tmp[121];
        cube[142] = cube_tmp[127];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[139];
        cube[145] = cube_tmp[216];
        cube[146] = cube_tmp[215];
        cube[147] = cube_tmp[214];
        cube[148] = cube_tmp[213];
        cube[149] = cube_tmp[212];
        cube[150] = cube_tmp[211];
        cube[151] = cube_tmp[210];
        cube[152] = cube_tmp[209];
        cube[153] = cube_tmp[208];
        cube[154] = cube_tmp[207];
        cube[155] = cube_tmp[206];
        cube[156] = cube_tmp[205];
        cube[157] = cube_tmp[204];
        cube[158] = cube_tmp[203];
        cube[159] = cube_tmp[202];
        cube[160] = cube_tmp[201];
        cube[161] = cube_tmp[200];
        cube[162] = cube_tmp[199];
        cube[163] = cube_tmp[198];
        cube[164] = cube_tmp[197];
        cube[165] = cube_tmp[196];
        cube[166] = cube_tmp[195];
        cube[167] = cube_tmp[194];
        cube[168] = cube_tmp[193];
        cube[169] = cube_tmp[192];
        cube[170] = cube_tmp[191];
        cube[171] = cube_tmp[190];
        cube[172] = cube_tmp[189];
        cube[173] = cube_tmp[188];
        cube[174] = cube_tmp[187];
        cube[175] = cube_tmp[186];
        cube[176] = cube_tmp[185];
        cube[177] = cube_tmp[184];
        cube[178] = cube_tmp[183];
        cube[179] = cube_tmp[182];
        cube[180] = cube_tmp[181];
        cube[181] = cube_tmp[73];
        cube[182] = cube_tmp[74];
        cube[183] = cube_tmp[75];
        cube[184] = cube_tmp[76];
        cube[185] = cube_tmp[77];
        cube[186] = cube_tmp[78];
        cube[187] = cube_tmp[79];
        cube[188] = cube_tmp[80];
        cube[189] = cube_tmp[81];
        cube[190] = cube_tmp[82];
        cube[191] = cube_tmp[83];
        cube[192] = cube_tmp[84];
        cube[193] = cube_tmp[85];
        cube[194] = cube_tmp[86];
        cube[195] = cube_tmp[87];
        cube[196] = cube_tmp[88];
        cube[197] = cube_tmp[89];
        cube[198] = cube_tmp[90];
        cube[199] = cube_tmp[91];
        cube[200] = cube_tmp[92];
        cube[201] = cube_tmp[93];
        cube[202] = cube_tmp[94];
        cube[203] = cube_tmp[95];
        cube[204] = cube_tmp[96];
        cube[205] = cube_tmp[97];
        cube[206] = cube_tmp[98];
        cube[207] = cube_tmp[99];
        cube[208] = cube_tmp[100];
        cube[209] = cube_tmp[101];
        cube[210] = cube_tmp[102];
        cube[211] = cube_tmp[103];
        cube[212] = cube_tmp[104];
        cube[213] = cube_tmp[105];
        cube[214] = cube_tmp[106];
        cube[215] = cube_tmp[107];
        cube[216] = cube_tmp[108];
        break;

    case Y:
        cube[1] = cube_tmp[31];
        cube[2] = cube_tmp[25];
        cube[3] = cube_tmp[19];
        cube[4] = cube_tmp[13];
        cube[5] = cube_tmp[7];
        cube[6] = cube_tmp[1];
        cube[7] = cube_tmp[32];
        cube[8] = cube_tmp[26];
        cube[9] = cube_tmp[20];
        cube[10] = cube_tmp[14];
        cube[11] = cube_tmp[8];
        cube[12] = cube_tmp[2];
        cube[13] = cube_tmp[33];
        cube[14] = cube_tmp[27];
        cube[15] = cube_tmp[21];
        cube[16] = cube_tmp[15];
        cube[17] = cube_tmp[9];
        cube[18] = cube_tmp[3];
        cube[19] = cube_tmp[34];
        cube[20] = cube_tmp[28];
        cube[21] = cube_tmp[22];
        cube[22] = cube_tmp[16];
        cube[23] = cube_tmp[10];
        cube[24] = cube_tmp[4];
        cube[25] = cube_tmp[35];
        cube[26] = cube_tmp[29];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[17];
        cube[29] = cube_tmp[11];
        cube[30] = cube_tmp[5];
        cube[31] = cube_tmp[36];
        cube[32] = cube_tmp[30];
        cube[33] = cube_tmp[24];
        cube[34] = cube_tmp[18];
        cube[35] = cube_tmp[12];
        cube[36] = cube_tmp[6];
        cube[37] = cube_tmp[73];
        cube[38] = cube_tmp[74];
        cube[39] = cube_tmp[75];
        cube[40] = cube_tmp[76];
        cube[41] = cube_tmp[77];
        cube[42] = cube_tmp[78];
        cube[43] = cube_tmp[79];
        cube[44] = cube_tmp[80];
        cube[45] = cube_tmp[81];
        cube[46] = cube_tmp[82];
        cube[47] = cube_tmp[83];
        cube[48] = cube_tmp[84];
        cube[49] = cube_tmp[85];
        cube[50] = cube_tmp[86];
        cube[51] = cube_tmp[87];
        cube[52] = cube_tmp[88];
        cube[53] = cube_tmp[89];
        cube[54] = cube_tmp[90];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[92];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[94];
        cube[59] = cube_tmp[95];
        cube[60] = cube_tmp[96];
        cube[61] = cube_tmp[97];
        cube[62] = cube_tmp[98];
        cube[63] = cube_tmp[99];
        cube[64] = cube_tmp[100];
        cube[65] = cube_tmp[101];
        cube[66] = cube_tmp[102];
        cube[67] = cube_tmp[103];
        cube[68] = cube_tmp[104];
        cube[69] = cube_tmp[105];
        cube[70] = cube_tmp[106];
        cube[71] = cube_tmp[107];
        cube[72] = cube_tmp[108];
        cube[73] = cube_tmp[109];
        cube[74] = cube_tmp[110];
        cube[75] = cube_tmp[111];
        cube[76] = cube_tmp[112];
        cube[77] = cube_tmp[113];
        cube[78] = cube_tmp[114];
        cube[79] = cube_tmp[115];
        cube[80] = cube_tmp[116];
        cube[81] = cube_tmp[117];
        cube[82] = cube_tmp[118];
        cube[83] = cube_tmp[119];
        cube[84] = cube_tmp[120];
        cube[85] = cube_tmp[121];
        cube[86] = cube_tmp[122];
        cube[87] = cube_tmp[123];
        cube[88] = cube_tmp[124];
        cube[89] = cube_tmp[125];
        cube[90] = cube_tmp[126];
        cube[91] = cube_tmp[127];
        cube[92] = cube_tmp[128];
        cube[93] = cube_tmp[129];
        cube[94] = cube_tmp[130];
        cube[95] = cube_tmp[131];
        cube[96] = cube_tmp[132];
        cube[97] = cube_tmp[133];
        cube[98] = cube_tmp[134];
        cube[99] = cube_tmp[135];
        cube[100] = cube_tmp[136];
        cube[101] = cube_tmp[137];
        cube[102] = cube_tmp[138];
        cube[103] = cube_tmp[139];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[143];
        cube[108] = cube_tmp[144];
        cube[109] = cube_tmp[145];
        cube[110] = cube_tmp[146];
        cube[111] = cube_tmp[147];
        cube[112] = cube_tmp[148];
        cube[113] = cube_tmp[149];
        cube[114] = cube_tmp[150];
        cube[115] = cube_tmp[151];
        cube[116] = cube_tmp[152];
        cube[117] = cube_tmp[153];
        cube[118] = cube_tmp[154];
        cube[119] = cube_tmp[155];
        cube[120] = cube_tmp[156];
        cube[121] = cube_tmp[157];
        cube[122] = cube_tmp[158];
        cube[123] = cube_tmp[159];
        cube[124] = cube_tmp[160];
        cube[125] = cube_tmp[161];
        cube[126] = cube_tmp[162];
        cube[127] = cube_tmp[163];
        cube[128] = cube_tmp[164];
        cube[129] = cube_tmp[165];
        cube[130] = cube_tmp[166];
        cube[131] = cube_tmp[167];
        cube[132] = cube_tmp[168];
        cube[133] = cube_tmp[169];
        cube[134] = cube_tmp[170];
        cube[135] = cube_tmp[171];
        cube[136] = cube_tmp[172];
        cube[137] = cube_tmp[173];
        cube[138] = cube_tmp[174];
        cube[139] = cube_tmp[175];
        cube[140] = cube_tmp[176];
        cube[141] = cube_tmp[177];
        cube[142] = cube_tmp[178];
        cube[143] = cube_tmp[179];
        cube[144] = cube_tmp[180];
        cube[145] = cube_tmp[37];
        cube[146] = cube_tmp[38];
        cube[147] = cube_tmp[39];
        cube[148] = cube_tmp[40];
        cube[149] = cube_tmp[41];
        cube[150] = cube_tmp[42];
        cube[151] = cube_tmp[43];
        cube[152] = cube_tmp[44];
        cube[153] = cube_tmp[45];
        cube[154] = cube_tmp[46];
        cube[155] = cube_tmp[47];
        cube[156] = cube_tmp[48];
        cube[157] = cube_tmp[49];
        cube[158] = cube_tmp[50];
        cube[159] = cube_tmp[51];
        cube[160] = cube_tmp[52];
        cube[161] = cube_tmp[53];
        cube[162] = cube_tmp[54];
        cube[163] = cube_tmp[55];
        cube[164] = cube_tmp[56];
        cube[165] = cube_tmp[57];
        cube[166] = cube_tmp[58];
        cube[167] = cube_tmp[59];
        cube[168] = cube_tmp[60];
        cube[169] = cube_tmp[61];
        cube[170] = cube_tmp[62];
        cube[171] = cube_tmp[63];
        cube[172] = cube_tmp[64];
        cube[173] = cube_tmp[65];
        cube[174] = cube_tmp[66];
        cube[175] = cube_tmp[67];
        cube[176] = cube_tmp[68];
        cube[177] = cube_tmp[69];
        cube[178] = cube_tmp[70];
        cube[179] = cube_tmp[71];
        cube[180] = cube_tmp[72];
        cube[181] = cube_tmp[186];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[198];
        cube[184] = cube_tmp[204];
        cube[185] = cube_tmp[210];
        cube[186] = cube_tmp[216];
        cube[187] = cube_tmp[185];
        cube[188] = cube_tmp[191];
        cube[189] = cube_tmp[197];
        cube[190] = cube_tmp[203];
        cube[191] = cube_tmp[209];
        cube[192] = cube_tmp[215];
        cube[193] = cube_tmp[184];
        cube[194] = cube_tmp[190];
        cube[195] = cube_tmp[196];
        cube[196] = cube_tmp[202];
        cube[197] = cube_tmp[208];
        cube[198] = cube_tmp[214];
        cube[199] = cube_tmp[183];
        cube[200] = cube_tmp[189];
        cube[201] = cube_tmp[195];
        cube[202] = cube_tmp[201];
        cube[203] = cube_tmp[207];
        cube[204] = cube_tmp[213];
        cube[205] = cube_tmp[182];
        cube[206] = cube_tmp[188];
        cube[207] = cube_tmp[194];
        cube[208] = cube_tmp[200];
        cube[209] = cube_tmp[206];
        cube[210] = cube_tmp[212];
        cube[211] = cube_tmp[181];
        cube[212] = cube_tmp[187];
        cube[213] = cube_tmp[193];
        cube[214] = cube_tmp[199];
        cube[215] = cube_tmp[205];
        cube[216] = cube_tmp[211];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[6];
        cube[2] = cube_tmp[12];
        cube[3] = cube_tmp[18];
        cube[4] = cube_tmp[24];
        cube[5] = cube_tmp[30];
        cube[6] = cube_tmp[36];
        cube[7] = cube_tmp[5];
        cube[8] = cube_tmp[11];
        cube[9] = cube_tmp[17];
        cube[10] = cube_tmp[23];
        cube[11] = cube_tmp[29];
        cube[12] = cube_tmp[35];
        cube[13] = cube_tmp[4];
        cube[14] = cube_tmp[10];
        cube[15] = cube_tmp[16];
        cube[16] = cube_tmp[22];
        cube[17] = cube_tmp[28];
        cube[18] = cube_tmp[34];
        cube[19] = cube_tmp[3];
        cube[20] = cube_tmp[9];
        cube[21] = cube_tmp[15];
        cube[22] = cube_tmp[21];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[33];
        cube[25] = cube_tmp[2];
        cube[26] = cube_tmp[8];
        cube[27] = cube_tmp[14];
        cube[28] = cube_tmp[20];
        cube[29] = cube_tmp[26];
        cube[30] = cube_tmp[32];
        cube[31] = cube_tmp[1];
        cube[32] = cube_tmp[7];
        cube[33] = cube_tmp[13];
        cube[34] = cube_tmp[19];
        cube[35] = cube_tmp[25];
        cube[36] = cube_tmp[31];
        cube[37] = cube_tmp[145];
        cube[38] = cube_tmp[146];
        cube[39] = cube_tmp[147];
        cube[40] = cube_tmp[148];
        cube[41] = cube_tmp[149];
        cube[42] = cube_tmp[150];
        cube[43] = cube_tmp[151];
        cube[44] = cube_tmp[152];
        cube[45] = cube_tmp[153];
        cube[46] = cube_tmp[154];
        cube[47] = cube_tmp[155];
        cube[48] = cube_tmp[156];
        cube[49] = cube_tmp[157];
        cube[50] = cube_tmp[158];
        cube[51] = cube_tmp[159];
        cube[52] = cube_tmp[160];
        cube[53] = cube_tmp[161];
        cube[54] = cube_tmp[162];
        cube[55] = cube_tmp[163];
        cube[56] = cube_tmp[164];
        cube[57] = cube_tmp[165];
        cube[58] = cube_tmp[166];
        cube[59] = cube_tmp[167];
        cube[60] = cube_tmp[168];
        cube[61] = cube_tmp[169];
        cube[62] = cube_tmp[170];
        cube[63] = cube_tmp[171];
        cube[64] = cube_tmp[172];
        cube[65] = cube_tmp[173];
        cube[66] = cube_tmp[174];
        cube[67] = cube_tmp[175];
        cube[68] = cube_tmp[176];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[178];
        cube[71] = cube_tmp[179];
        cube[72] = cube_tmp[180];
        cube[73] = cube_tmp[37];
        cube[74] = cube_tmp[38];
        cube[75] = cube_tmp[39];
        cube[76] = cube_tmp[40];
        cube[77] = cube_tmp[41];
        cube[78] = cube_tmp[42];
        cube[79] = cube_tmp[43];
        cube[80] = cube_tmp[44];
        cube[81] = cube_tmp[45];
        cube[82] = cube_tmp[46];
        cube[83] = cube_tmp[47];
        cube[84] = cube_tmp[48];
        cube[85] = cube_tmp[49];
        cube[86] = cube_tmp[50];
        cube[87] = cube_tmp[51];
        cube[88] = cube_tmp[52];
        cube[89] = cube_tmp[53];
        cube[90] = cube_tmp[54];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[56];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[58];
        cube[95] = cube_tmp[59];
        cube[96] = cube_tmp[60];
        cube[97] = cube_tmp[61];
        cube[98] = cube_tmp[62];
        cube[99] = cube_tmp[63];
        cube[100] = cube_tmp[64];
        cube[101] = cube_tmp[65];
        cube[102] = cube_tmp[66];
        cube[103] = cube_tmp[67];
        cube[104] = cube_tmp[68];
        cube[105] = cube_tmp[69];
        cube[106] = cube_tmp[70];
        cube[107] = cube_tmp[71];
        cube[108] = cube_tmp[72];
        cube[109] = cube_tmp[73];
        cube[110] = cube_tmp[74];
        cube[111] = cube_tmp[75];
        cube[112] = cube_tmp[76];
        cube[113] = cube_tmp[77];
        cube[114] = cube_tmp[78];
        cube[115] = cube_tmp[79];
        cube[116] = cube_tmp[80];
        cube[117] = cube_tmp[81];
        cube[118] = cube_tmp[82];
        cube[119] = cube_tmp[83];
        cube[120] = cube_tmp[84];
        cube[121] = cube_tmp[85];
        cube[122] = cube_tmp[86];
        cube[123] = cube_tmp[87];
        cube[124] = cube_tmp[88];
        cube[125] = cube_tmp[89];
        cube[126] = cube_tmp[90];
        cube[127] = cube_tmp[91];
        cube[128] = cube_tmp[92];
        cube[129] = cube_tmp[93];
        cube[130] = cube_tmp[94];
        cube[131] = cube_tmp[95];
        cube[132] = cube_tmp[96];
        cube[133] = cube_tmp[97];
        cube[134] = cube_tmp[98];
        cube[135] = cube_tmp[99];
        cube[136] = cube_tmp[100];
        cube[137] = cube_tmp[101];
        cube[138] = cube_tmp[102];
        cube[139] = cube_tmp[103];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[107];
        cube[144] = cube_tmp[108];
        cube[145] = cube_tmp[109];
        cube[146] = cube_tmp[110];
        cube[147] = cube_tmp[111];
        cube[148] = cube_tmp[112];
        cube[149] = cube_tmp[113];
        cube[150] = cube_tmp[114];
        cube[151] = cube_tmp[115];
        cube[152] = cube_tmp[116];
        cube[153] = cube_tmp[117];
        cube[154] = cube_tmp[118];
        cube[155] = cube_tmp[119];
        cube[156] = cube_tmp[120];
        cube[157] = cube_tmp[121];
        cube[158] = cube_tmp[122];
        cube[159] = cube_tmp[123];
        cube[160] = cube_tmp[124];
        cube[161] = cube_tmp[125];
        cube[162] = cube_tmp[126];
        cube[163] = cube_tmp[127];
        cube[164] = cube_tmp[128];
        cube[165] = cube_tmp[129];
        cube[166] = cube_tmp[130];
        cube[167] = cube_tmp[131];
        cube[168] = cube_tmp[132];
        cube[169] = cube_tmp[133];
        cube[170] = cube_tmp[134];
        cube[171] = cube_tmp[135];
        cube[172] = cube_tmp[136];
        cube[173] = cube_tmp[137];
        cube[174] = cube_tmp[138];
        cube[175] = cube_tmp[139];
        cube[176] = cube_tmp[140];
        cube[177] = cube_tmp[141];
        cube[178] = cube_tmp[142];
        cube[179] = cube_tmp[143];
        cube[180] = cube_tmp[144];
        cube[181] = cube_tmp[211];
        cube[182] = cube_tmp[205];
        cube[183] = cube_tmp[199];
        cube[184] = cube_tmp[193];
        cube[185] = cube_tmp[187];
        cube[186] = cube_tmp[181];
        cube[187] = cube_tmp[212];
        cube[188] = cube_tmp[206];
        cube[189] = cube_tmp[200];
        cube[190] = cube_tmp[194];
        cube[191] = cube_tmp[188];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[213];
        cube[194] = cube_tmp[207];
        cube[195] = cube_tmp[201];
        cube[196] = cube_tmp[195];
        cube[197] = cube_tmp[189];
        cube[198] = cube_tmp[183];
        cube[199] = cube_tmp[214];
        cube[200] = cube_tmp[208];
        cube[201] = cube_tmp[202];
        cube[202] = cube_tmp[196];
        cube[203] = cube_tmp[190];
        cube[204] = cube_tmp[184];
        cube[205] = cube_tmp[215];
        cube[206] = cube_tmp[209];
        cube[207] = cube_tmp[203];
        cube[208] = cube_tmp[197];
        cube[209] = cube_tmp[191];
        cube[210] = cube_tmp[185];
        cube[211] = cube_tmp[216];
        cube[212] = cube_tmp[210];
        cube[213] = cube_tmp[204];
        cube[214] = cube_tmp[198];
        cube[215] = cube_tmp[192];
        cube[216] = cube_tmp[186];
        break;

    case Z:
        cube[1] = cube_tmp[67];
        cube[2] = cube_tmp[61];
        cube[3] = cube_tmp[55];
        cube[4] = cube_tmp[49];
        cube[5] = cube_tmp[43];
        cube[6] = cube_tmp[37];
        cube[7] = cube_tmp[68];
        cube[8] = cube_tmp[62];
        cube[9] = cube_tmp[56];
        cube[10] = cube_tmp[50];
        cube[11] = cube_tmp[44];
        cube[12] = cube_tmp[38];
        cube[13] = cube_tmp[69];
        cube[14] = cube_tmp[63];
        cube[15] = cube_tmp[57];
        cube[16] = cube_tmp[51];
        cube[17] = cube_tmp[45];
        cube[18] = cube_tmp[39];
        cube[19] = cube_tmp[70];
        cube[20] = cube_tmp[64];
        cube[21] = cube_tmp[58];
        cube[22] = cube_tmp[52];
        cube[23] = cube_tmp[46];
        cube[24] = cube_tmp[40];
        cube[25] = cube_tmp[71];
        cube[26] = cube_tmp[65];
        cube[27] = cube_tmp[59];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[41];
        cube[31] = cube_tmp[72];
        cube[32] = cube_tmp[66];
        cube[33] = cube_tmp[60];
        cube[34] = cube_tmp[54];
        cube[35] = cube_tmp[48];
        cube[36] = cube_tmp[42];
        cube[37] = cube_tmp[211];
        cube[38] = cube_tmp[205];
        cube[39] = cube_tmp[199];
        cube[40] = cube_tmp[193];
        cube[41] = cube_tmp[187];
        cube[42] = cube_tmp[181];
        cube[43] = cube_tmp[212];
        cube[44] = cube_tmp[206];
        cube[45] = cube_tmp[200];
        cube[46] = cube_tmp[194];
        cube[47] = cube_tmp[188];
        cube[48] = cube_tmp[182];
        cube[49] = cube_tmp[213];
        cube[50] = cube_tmp[207];
        cube[51] = cube_tmp[201];
        cube[52] = cube_tmp[195];
        cube[53] = cube_tmp[189];
        cube[54] = cube_tmp[183];
        cube[55] = cube_tmp[214];
        cube[56] = cube_tmp[208];
        cube[57] = cube_tmp[202];
        cube[58] = cube_tmp[196];
        cube[59] = cube_tmp[190];
        cube[60] = cube_tmp[184];
        cube[61] = cube_tmp[215];
        cube[62] = cube_tmp[209];
        cube[63] = cube_tmp[203];
        cube[64] = cube_tmp[197];
        cube[65] = cube_tmp[191];
        cube[66] = cube_tmp[185];
        cube[67] = cube_tmp[216];
        cube[68] = cube_tmp[210];
        cube[69] = cube_tmp[204];
        cube[70] = cube_tmp[198];
        cube[71] = cube_tmp[192];
        cube[72] = cube_tmp[186];
        cube[73] = cube_tmp[103];
        cube[74] = cube_tmp[97];
        cube[75] = cube_tmp[91];
        cube[76] = cube_tmp[85];
        cube[77] = cube_tmp[79];
        cube[78] = cube_tmp[73];
        cube[79] = cube_tmp[104];
        cube[80] = cube_tmp[98];
        cube[81] = cube_tmp[92];
        cube[82] = cube_tmp[86];
        cube[83] = cube_tmp[80];
        cube[84] = cube_tmp[74];
        cube[85] = cube_tmp[105];
        cube[86] = cube_tmp[99];
        cube[87] = cube_tmp[93];
        cube[88] = cube_tmp[87];
        cube[89] = cube_tmp[81];
        cube[90] = cube_tmp[75];
        cube[91] = cube_tmp[106];
        cube[92] = cube_tmp[100];
        cube[93] = cube_tmp[94];
        cube[94] = cube_tmp[88];
        cube[95] = cube_tmp[82];
        cube[96] = cube_tmp[76];
        cube[97] = cube_tmp[107];
        cube[98] = cube_tmp[101];
        cube[99] = cube_tmp[95];
        cube[100] = cube_tmp[89];
        cube[101] = cube_tmp[83];
        cube[102] = cube_tmp[77];
        cube[103] = cube_tmp[108];
        cube[104] = cube_tmp[102];
        cube[105] = cube_tmp[96];
        cube[106] = cube_tmp[90];
        cube[107] = cube_tmp[84];
        cube[108] = cube_tmp[78];
        cube[109] = cube_tmp[31];
        cube[110] = cube_tmp[25];
        cube[111] = cube_tmp[19];
        cube[112] = cube_tmp[13];
        cube[113] = cube_tmp[7];
        cube[114] = cube_tmp[1];
        cube[115] = cube_tmp[32];
        cube[116] = cube_tmp[26];
        cube[117] = cube_tmp[20];
        cube[118] = cube_tmp[14];
        cube[119] = cube_tmp[8];
        cube[120] = cube_tmp[2];
        cube[121] = cube_tmp[33];
        cube[122] = cube_tmp[27];
        cube[123] = cube_tmp[21];
        cube[124] = cube_tmp[15];
        cube[125] = cube_tmp[9];
        cube[126] = cube_tmp[3];
        cube[127] = cube_tmp[34];
        cube[128] = cube_tmp[28];
        cube[129] = cube_tmp[22];
        cube[130] = cube_tmp[16];
        cube[131] = cube_tmp[10];
        cube[132] = cube_tmp[4];
        cube[133] = cube_tmp[35];
        cube[134] = cube_tmp[29];
        cube[135] = cube_tmp[23];
        cube[136] = cube_tmp[17];
        cube[137] = cube_tmp[11];
        cube[138] = cube_tmp[5];
        cube[139] = cube_tmp[36];
        cube[140] = cube_tmp[30];
        cube[141] = cube_tmp[24];
        cube[142] = cube_tmp[18];
        cube[143] = cube_tmp[12];
        cube[144] = cube_tmp[6];
        cube[145] = cube_tmp[150];
        cube[146] = cube_tmp[156];
        cube[147] = cube_tmp[162];
        cube[148] = cube_tmp[168];
        cube[149] = cube_tmp[174];
        cube[150] = cube_tmp[180];
        cube[151] = cube_tmp[149];
        cube[152] = cube_tmp[155];
        cube[153] = cube_tmp[161];
        cube[154] = cube_tmp[167];
        cube[155] = cube_tmp[173];
        cube[156] = cube_tmp[179];
        cube[157] = cube_tmp[148];
        cube[158] = cube_tmp[154];
        cube[159] = cube_tmp[160];
        cube[160] = cube_tmp[166];
        cube[161] = cube_tmp[172];
        cube[162] = cube_tmp[178];
        cube[163] = cube_tmp[147];
        cube[164] = cube_tmp[153];
        cube[165] = cube_tmp[159];
        cube[166] = cube_tmp[165];
        cube[167] = cube_tmp[171];
        cube[168] = cube_tmp[177];
        cube[169] = cube_tmp[146];
        cube[170] = cube_tmp[152];
        cube[171] = cube_tmp[158];
        cube[172] = cube_tmp[164];
        cube[173] = cube_tmp[170];
        cube[174] = cube_tmp[176];
        cube[175] = cube_tmp[145];
        cube[176] = cube_tmp[151];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[163];
        cube[179] = cube_tmp[169];
        cube[180] = cube_tmp[175];
        cube[181] = cube_tmp[139];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[127];
        cube[184] = cube_tmp[121];
        cube[185] = cube_tmp[115];
        cube[186] = cube_tmp[109];
        cube[187] = cube_tmp[140];
        cube[188] = cube_tmp[134];
        cube[189] = cube_tmp[128];
        cube[190] = cube_tmp[122];
        cube[191] = cube_tmp[116];
        cube[192] = cube_tmp[110];
        cube[193] = cube_tmp[141];
        cube[194] = cube_tmp[135];
        cube[195] = cube_tmp[129];
        cube[196] = cube_tmp[123];
        cube[197] = cube_tmp[117];
        cube[198] = cube_tmp[111];
        cube[199] = cube_tmp[142];
        cube[200] = cube_tmp[136];
        cube[201] = cube_tmp[130];
        cube[202] = cube_tmp[124];
        cube[203] = cube_tmp[118];
        cube[204] = cube_tmp[112];
        cube[205] = cube_tmp[143];
        cube[206] = cube_tmp[137];
        cube[207] = cube_tmp[131];
        cube[208] = cube_tmp[125];
        cube[209] = cube_tmp[119];
        cube[210] = cube_tmp[113];
        cube[211] = cube_tmp[144];
        cube[212] = cube_tmp[138];
        cube[213] = cube_tmp[132];
        cube[214] = cube_tmp[126];
        cube[215] = cube_tmp[120];
        cube[216] = cube_tmp[114];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[114];
        cube[2] = cube_tmp[120];
        cube[3] = cube_tmp[126];
        cube[4] = cube_tmp[132];
        cube[5] = cube_tmp[138];
        cube[6] = cube_tmp[144];
        cube[7] = cube_tmp[113];
        cube[8] = cube_tmp[119];
        cube[9] = cube_tmp[125];
        cube[10] = cube_tmp[131];
        cube[11] = cube_tmp[137];
        cube[12] = cube_tmp[143];
        cube[13] = cube_tmp[112];
        cube[14] = cube_tmp[118];
        cube[15] = cube_tmp[124];
        cube[16] = cube_tmp[130];
        cube[17] = cube_tmp[136];
        cube[18] = cube_tmp[142];
        cube[19] = cube_tmp[111];
        cube[20] = cube_tmp[117];
        cube[21] = cube_tmp[123];
        cube[22] = cube_tmp[129];
        cube[23] = cube_tmp[135];
        cube[24] = cube_tmp[141];
        cube[25] = cube_tmp[110];
        cube[26] = cube_tmp[116];
        cube[27] = cube_tmp[122];
        cube[28] = cube_tmp[128];
        cube[29] = cube_tmp[134];
        cube[30] = cube_tmp[140];
        cube[31] = cube_tmp[109];
        cube[32] = cube_tmp[115];
        cube[33] = cube_tmp[121];
        cube[34] = cube_tmp[127];
        cube[35] = cube_tmp[133];
        cube[36] = cube_tmp[139];
        cube[37] = cube_tmp[6];
        cube[38] = cube_tmp[12];
        cube[39] = cube_tmp[18];
        cube[40] = cube_tmp[24];
        cube[41] = cube_tmp[30];
        cube[42] = cube_tmp[36];
        cube[43] = cube_tmp[5];
        cube[44] = cube_tmp[11];
        cube[45] = cube_tmp[17];
        cube[46] = cube_tmp[23];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[35];
        cube[49] = cube_tmp[4];
        cube[50] = cube_tmp[10];
        cube[51] = cube_tmp[16];
        cube[52] = cube_tmp[22];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[34];
        cube[55] = cube_tmp[3];
        cube[56] = cube_tmp[9];
        cube[57] = cube_tmp[15];
        cube[58] = cube_tmp[21];
        cube[59] = cube_tmp[27];
        cube[60] = cube_tmp[33];
        cube[61] = cube_tmp[2];
        cube[62] = cube_tmp[8];
        cube[63] = cube_tmp[14];
        cube[64] = cube_tmp[20];
        cube[65] = cube_tmp[26];
        cube[66] = cube_tmp[32];
        cube[67] = cube_tmp[1];
        cube[68] = cube_tmp[7];
        cube[69] = cube_tmp[13];
        cube[70] = cube_tmp[19];
        cube[71] = cube_tmp[25];
        cube[72] = cube_tmp[31];
        cube[73] = cube_tmp[78];
        cube[74] = cube_tmp[84];
        cube[75] = cube_tmp[90];
        cube[76] = cube_tmp[96];
        cube[77] = cube_tmp[102];
        cube[78] = cube_tmp[108];
        cube[79] = cube_tmp[77];
        cube[80] = cube_tmp[83];
        cube[81] = cube_tmp[89];
        cube[82] = cube_tmp[95];
        cube[83] = cube_tmp[101];
        cube[84] = cube_tmp[107];
        cube[85] = cube_tmp[76];
        cube[86] = cube_tmp[82];
        cube[87] = cube_tmp[88];
        cube[88] = cube_tmp[94];
        cube[89] = cube_tmp[100];
        cube[90] = cube_tmp[106];
        cube[91] = cube_tmp[75];
        cube[92] = cube_tmp[81];
        cube[93] = cube_tmp[87];
        cube[94] = cube_tmp[93];
        cube[95] = cube_tmp[99];
        cube[96] = cube_tmp[105];
        cube[97] = cube_tmp[74];
        cube[98] = cube_tmp[80];
        cube[99] = cube_tmp[86];
        cube[100] = cube_tmp[92];
        cube[101] = cube_tmp[98];
        cube[102] = cube_tmp[104];
        cube[103] = cube_tmp[73];
        cube[104] = cube_tmp[79];
        cube[105] = cube_tmp[85];
        cube[106] = cube_tmp[91];
        cube[107] = cube_tmp[97];
        cube[108] = cube_tmp[103];
        cube[109] = cube_tmp[186];
        cube[110] = cube_tmp[192];
        cube[111] = cube_tmp[198];
        cube[112] = cube_tmp[204];
        cube[113] = cube_tmp[210];
        cube[114] = cube_tmp[216];
        cube[115] = cube_tmp[185];
        cube[116] = cube_tmp[191];
        cube[117] = cube_tmp[197];
        cube[118] = cube_tmp[203];
        cube[119] = cube_tmp[209];
        cube[120] = cube_tmp[215];
        cube[121] = cube_tmp[184];
        cube[122] = cube_tmp[190];
        cube[123] = cube_tmp[196];
        cube[124] = cube_tmp[202];
        cube[125] = cube_tmp[208];
        cube[126] = cube_tmp[214];
        cube[127] = cube_tmp[183];
        cube[128] = cube_tmp[189];
        cube[129] = cube_tmp[195];
        cube[130] = cube_tmp[201];
        cube[131] = cube_tmp[207];
        cube[132] = cube_tmp[213];
        cube[133] = cube_tmp[182];
        cube[134] = cube_tmp[188];
        cube[135] = cube_tmp[194];
        cube[136] = cube_tmp[200];
        cube[137] = cube_tmp[206];
        cube[138] = cube_tmp[212];
        cube[139] = cube_tmp[181];
        cube[140] = cube_tmp[187];
        cube[141] = cube_tmp[193];
        cube[142] = cube_tmp[199];
        cube[143] = cube_tmp[205];
        cube[144] = cube_tmp[211];
        cube[145] = cube_tmp[175];
        cube[146] = cube_tmp[169];
        cube[147] = cube_tmp[163];
        cube[148] = cube_tmp[157];
        cube[149] = cube_tmp[151];
        cube[150] = cube_tmp[145];
        cube[151] = cube_tmp[176];
        cube[152] = cube_tmp[170];
        cube[153] = cube_tmp[164];
        cube[154] = cube_tmp[158];
        cube[155] = cube_tmp[152];
        cube[156] = cube_tmp[146];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[171];
        cube[159] = cube_tmp[165];
        cube[160] = cube_tmp[159];
        cube[161] = cube_tmp[153];
        cube[162] = cube_tmp[147];
        cube[163] = cube_tmp[178];
        cube[164] = cube_tmp[172];
        cube[165] = cube_tmp[166];
        cube[166] = cube_tmp[160];
        cube[167] = cube_tmp[154];
        cube[168] = cube_tmp[148];
        cube[169] = cube_tmp[179];
        cube[170] = cube_tmp[173];
        cube[171] = cube_tmp[167];
        cube[172] = cube_tmp[161];
        cube[173] = cube_tmp[155];
        cube[174] = cube_tmp[149];
        cube[175] = cube_tmp[180];
        cube[176] = cube_tmp[174];
        cube[177] = cube_tmp[168];
        cube[178] = cube_tmp[162];
        cube[179] = cube_tmp[156];
        cube[180] = cube_tmp[150];
        cube[181] = cube_tmp[42];
        cube[182] = cube_tmp[48];
        cube[183] = cube_tmp[54];
        cube[184] = cube_tmp[60];
        cube[185] = cube_tmp[66];
        cube[186] = cube_tmp[72];
        cube[187] = cube_tmp[41];
        cube[188] = cube_tmp[47];
        cube[189] = cube_tmp[53];
        cube[190] = cube_tmp[59];
        cube[191] = cube_tmp[65];
        cube[192] = cube_tmp[71];
        cube[193] = cube_tmp[40];
        cube[194] = cube_tmp[46];
        cube[195] = cube_tmp[52];
        cube[196] = cube_tmp[58];
        cube[197] = cube_tmp[64];
        cube[198] = cube_tmp[70];
        cube[199] = cube_tmp[39];
        cube[200] = cube_tmp[45];
        cube[201] = cube_tmp[51];
        cube[202] = cube_tmp[57];
        cube[203] = cube_tmp[63];
        cube[204] = cube_tmp[69];
        cube[205] = cube_tmp[38];
        cube[206] = cube_tmp[44];
        cube[207] = cube_tmp[50];
        cube[208] = cube_tmp[56];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[68];
        cube[211] = cube_tmp[37];
        cube[212] = cube_tmp[43];
        cube[213] = cube_tmp[49];
        cube[214] = cube_tmp[55];
        cube[215] = cube_tmp[61];
        cube[216] = cube_tmp[67];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

void
rotate_777(char *cube, char *cube_tmp, int array_size, move_type move)
{
    /* This was contructed using utils/rotate-printer.py */
    memcpy(cube_tmp, cube, sizeof(char) * array_size);

    switch (move) {
    case U:
        cube[1] = cube_tmp[43];
        cube[2] = cube_tmp[36];
        cube[3] = cube_tmp[29];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[15];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[44];
        cube[9] = cube_tmp[37];
        cube[10] = cube_tmp[30];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[2];
        cube[15] = cube_tmp[45];
        cube[16] = cube_tmp[38];
        cube[17] = cube_tmp[31];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[10];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[46];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[32];
        cube[26] = cube_tmp[18];
        cube[27] = cube_tmp[11];
        cube[28] = cube_tmp[4];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[40];
        cube[31] = cube_tmp[33];
        cube[32] = cube_tmp[26];
        cube[33] = cube_tmp[19];
        cube[34] = cube_tmp[12];
        cube[35] = cube_tmp[5];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[41];
        cube[38] = cube_tmp[34];
        cube[39] = cube_tmp[27];
        cube[40] = cube_tmp[20];
        cube[41] = cube_tmp[13];
        cube[42] = cube_tmp[6];
        cube[43] = cube_tmp[49];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[35];
        cube[46] = cube_tmp[28];
        cube[47] = cube_tmp[21];
        cube[48] = cube_tmp[14];
        cube[49] = cube_tmp[7];
        cube[50] = cube_tmp[99];
        cube[51] = cube_tmp[100];
        cube[52] = cube_tmp[101];
        cube[53] = cube_tmp[102];
        cube[54] = cube_tmp[103];
        cube[55] = cube_tmp[104];
        cube[56] = cube_tmp[105];
        cube[99] = cube_tmp[148];
        cube[100] = cube_tmp[149];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[151];
        cube[103] = cube_tmp[152];
        cube[104] = cube_tmp[153];
        cube[105] = cube_tmp[154];
        cube[148] = cube_tmp[197];
        cube[149] = cube_tmp[198];
        cube[150] = cube_tmp[199];
        cube[151] = cube_tmp[200];
        cube[152] = cube_tmp[201];
        cube[153] = cube_tmp[202];
        cube[154] = cube_tmp[203];
        cube[197] = cube_tmp[50];
        cube[198] = cube_tmp[51];
        cube[199] = cube_tmp[52];
        cube[200] = cube_tmp[53];
        cube[201] = cube_tmp[54];
        cube[202] = cube_tmp[55];
        cube[203] = cube_tmp[56];
        break;

    case U_PRIME:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[14];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[28];
        cube[5] = cube_tmp[35];
        cube[6] = cube_tmp[42];
        cube[7] = cube_tmp[49];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[20];
        cube[11] = cube_tmp[27];
        cube[12] = cube_tmp[34];
        cube[13] = cube_tmp[41];
        cube[14] = cube_tmp[48];
        cube[15] = cube_tmp[5];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[26];
        cube[19] = cube_tmp[33];
        cube[20] = cube_tmp[40];
        cube[21] = cube_tmp[47];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[18];
        cube[26] = cube_tmp[32];
        cube[27] = cube_tmp[39];
        cube[28] = cube_tmp[46];
        cube[29] = cube_tmp[3];
        cube[30] = cube_tmp[10];
        cube[31] = cube_tmp[17];
        cube[32] = cube_tmp[24];
        cube[33] = cube_tmp[31];
        cube[34] = cube_tmp[38];
        cube[35] = cube_tmp[45];
        cube[36] = cube_tmp[2];
        cube[37] = cube_tmp[9];
        cube[38] = cube_tmp[16];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[30];
        cube[41] = cube_tmp[37];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[1];
        cube[44] = cube_tmp[8];
        cube[45] = cube_tmp[15];
        cube[46] = cube_tmp[22];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[43];
        cube[50] = cube_tmp[197];
        cube[51] = cube_tmp[198];
        cube[52] = cube_tmp[199];
        cube[53] = cube_tmp[200];
        cube[54] = cube_tmp[201];
        cube[55] = cube_tmp[202];
        cube[56] = cube_tmp[203];
        cube[99] = cube_tmp[50];
        cube[100] = cube_tmp[51];
        cube[101] = cube_tmp[52];
        cube[102] = cube_tmp[53];
        cube[103] = cube_tmp[54];
        cube[104] = cube_tmp[55];
        cube[105] = cube_tmp[56];
        cube[148] = cube_tmp[99];
        cube[149] = cube_tmp[100];
        cube[150] = cube_tmp[101];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[103];
        cube[153] = cube_tmp[104];
        cube[154] = cube_tmp[105];
        cube[197] = cube_tmp[148];
        cube[198] = cube_tmp[149];
        cube[199] = cube_tmp[150];
        cube[200] = cube_tmp[151];
        cube[201] = cube_tmp[152];
        cube[202] = cube_tmp[153];
        cube[203] = cube_tmp[154];
        break;

    case U2:
        cube[1] = cube_tmp[49];
        cube[2] = cube_tmp[48];
        cube[3] = cube_tmp[47];
        cube[4] = cube_tmp[46];
        cube[5] = cube_tmp[45];
        cube[6] = cube_tmp[44];
        cube[7] = cube_tmp[43];
        cube[8] = cube_tmp[42];
        cube[9] = cube_tmp[41];
        cube[10] = cube_tmp[40];
        cube[11] = cube_tmp[39];
        cube[12] = cube_tmp[38];
        cube[13] = cube_tmp[37];
        cube[14] = cube_tmp[36];
        cube[15] = cube_tmp[35];
        cube[16] = cube_tmp[34];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[32];
        cube[19] = cube_tmp[31];
        cube[20] = cube_tmp[30];
        cube[21] = cube_tmp[29];
        cube[22] = cube_tmp[28];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[26];
        cube[26] = cube_tmp[24];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[22];
        cube[29] = cube_tmp[21];
        cube[30] = cube_tmp[20];
        cube[31] = cube_tmp[19];
        cube[32] = cube_tmp[18];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[16];
        cube[35] = cube_tmp[15];
        cube[36] = cube_tmp[14];
        cube[37] = cube_tmp[13];
        cube[38] = cube_tmp[12];
        cube[39] = cube_tmp[11];
        cube[40] = cube_tmp[10];
        cube[41] = cube_tmp[9];
        cube[42] = cube_tmp[8];
        cube[43] = cube_tmp[7];
        cube[44] = cube_tmp[6];
        cube[45] = cube_tmp[5];
        cube[46] = cube_tmp[4];
        cube[47] = cube_tmp[3];
        cube[48] = cube_tmp[2];
        cube[49] = cube_tmp[1];
        cube[50] = cube_tmp[148];
        cube[51] = cube_tmp[149];
        cube[52] = cube_tmp[150];
        cube[53] = cube_tmp[151];
        cube[54] = cube_tmp[152];
        cube[55] = cube_tmp[153];
        cube[56] = cube_tmp[154];
        cube[99] = cube_tmp[197];
        cube[100] = cube_tmp[198];
        cube[101] = cube_tmp[199];
        cube[102] = cube_tmp[200];
        cube[103] = cube_tmp[201];
        cube[104] = cube_tmp[202];
        cube[105] = cube_tmp[203];
        cube[148] = cube_tmp[50];
        cube[149] = cube_tmp[51];
        cube[150] = cube_tmp[52];
        cube[151] = cube_tmp[53];
        cube[152] = cube_tmp[54];
        cube[153] = cube_tmp[55];
        cube[154] = cube_tmp[56];
        cube[197] = cube_tmp[99];
        cube[198] = cube_tmp[100];
        cube[199] = cube_tmp[101];
        cube[200] = cube_tmp[102];
        cube[201] = cube_tmp[103];
        cube[202] = cube_tmp[104];
        cube[203] = cube_tmp[105];
        break;

    case Uw:
        cube[1] = cube_tmp[43];
        cube[2] = cube_tmp[36];
        cube[3] = cube_tmp[29];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[15];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[44];
        cube[9] = cube_tmp[37];
        cube[10] = cube_tmp[30];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[2];
        cube[15] = cube_tmp[45];
        cube[16] = cube_tmp[38];
        cube[17] = cube_tmp[31];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[10];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[46];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[32];
        cube[26] = cube_tmp[18];
        cube[27] = cube_tmp[11];
        cube[28] = cube_tmp[4];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[40];
        cube[31] = cube_tmp[33];
        cube[32] = cube_tmp[26];
        cube[33] = cube_tmp[19];
        cube[34] = cube_tmp[12];
        cube[35] = cube_tmp[5];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[41];
        cube[38] = cube_tmp[34];
        cube[39] = cube_tmp[27];
        cube[40] = cube_tmp[20];
        cube[41] = cube_tmp[13];
        cube[42] = cube_tmp[6];
        cube[43] = cube_tmp[49];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[35];
        cube[46] = cube_tmp[28];
        cube[47] = cube_tmp[21];
        cube[48] = cube_tmp[14];
        cube[49] = cube_tmp[7];
        cube[50] = cube_tmp[99];
        cube[51] = cube_tmp[100];
        cube[52] = cube_tmp[101];
        cube[53] = cube_tmp[102];
        cube[54] = cube_tmp[103];
        cube[55] = cube_tmp[104];
        cube[56] = cube_tmp[105];
        cube[57] = cube_tmp[106];
        cube[58] = cube_tmp[107];
        cube[59] = cube_tmp[108];
        cube[60] = cube_tmp[109];
        cube[61] = cube_tmp[110];
        cube[62] = cube_tmp[111];
        cube[63] = cube_tmp[112];
        cube[99] = cube_tmp[148];
        cube[100] = cube_tmp[149];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[151];
        cube[103] = cube_tmp[152];
        cube[104] = cube_tmp[153];
        cube[105] = cube_tmp[154];
        cube[106] = cube_tmp[155];
        cube[107] = cube_tmp[156];
        cube[108] = cube_tmp[157];
        cube[109] = cube_tmp[158];
        cube[110] = cube_tmp[159];
        cube[111] = cube_tmp[160];
        cube[112] = cube_tmp[161];
        cube[148] = cube_tmp[197];
        cube[149] = cube_tmp[198];
        cube[150] = cube_tmp[199];
        cube[151] = cube_tmp[200];
        cube[152] = cube_tmp[201];
        cube[153] = cube_tmp[202];
        cube[154] = cube_tmp[203];
        cube[155] = cube_tmp[204];
        cube[156] = cube_tmp[205];
        cube[157] = cube_tmp[206];
        cube[158] = cube_tmp[207];
        cube[159] = cube_tmp[208];
        cube[160] = cube_tmp[209];
        cube[161] = cube_tmp[210];
        cube[197] = cube_tmp[50];
        cube[198] = cube_tmp[51];
        cube[199] = cube_tmp[52];
        cube[200] = cube_tmp[53];
        cube[201] = cube_tmp[54];
        cube[202] = cube_tmp[55];
        cube[203] = cube_tmp[56];
        cube[204] = cube_tmp[57];
        cube[205] = cube_tmp[58];
        cube[206] = cube_tmp[59];
        cube[207] = cube_tmp[60];
        cube[208] = cube_tmp[61];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[63];
        break;

    case Uw_PRIME:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[14];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[28];
        cube[5] = cube_tmp[35];
        cube[6] = cube_tmp[42];
        cube[7] = cube_tmp[49];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[20];
        cube[11] = cube_tmp[27];
        cube[12] = cube_tmp[34];
        cube[13] = cube_tmp[41];
        cube[14] = cube_tmp[48];
        cube[15] = cube_tmp[5];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[26];
        cube[19] = cube_tmp[33];
        cube[20] = cube_tmp[40];
        cube[21] = cube_tmp[47];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[18];
        cube[26] = cube_tmp[32];
        cube[27] = cube_tmp[39];
        cube[28] = cube_tmp[46];
        cube[29] = cube_tmp[3];
        cube[30] = cube_tmp[10];
        cube[31] = cube_tmp[17];
        cube[32] = cube_tmp[24];
        cube[33] = cube_tmp[31];
        cube[34] = cube_tmp[38];
        cube[35] = cube_tmp[45];
        cube[36] = cube_tmp[2];
        cube[37] = cube_tmp[9];
        cube[38] = cube_tmp[16];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[30];
        cube[41] = cube_tmp[37];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[1];
        cube[44] = cube_tmp[8];
        cube[45] = cube_tmp[15];
        cube[46] = cube_tmp[22];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[43];
        cube[50] = cube_tmp[197];
        cube[51] = cube_tmp[198];
        cube[52] = cube_tmp[199];
        cube[53] = cube_tmp[200];
        cube[54] = cube_tmp[201];
        cube[55] = cube_tmp[202];
        cube[56] = cube_tmp[203];
        cube[57] = cube_tmp[204];
        cube[58] = cube_tmp[205];
        cube[59] = cube_tmp[206];
        cube[60] = cube_tmp[207];
        cube[61] = cube_tmp[208];
        cube[62] = cube_tmp[209];
        cube[63] = cube_tmp[210];
        cube[99] = cube_tmp[50];
        cube[100] = cube_tmp[51];
        cube[101] = cube_tmp[52];
        cube[102] = cube_tmp[53];
        cube[103] = cube_tmp[54];
        cube[104] = cube_tmp[55];
        cube[105] = cube_tmp[56];
        cube[106] = cube_tmp[57];
        cube[107] = cube_tmp[58];
        cube[108] = cube_tmp[59];
        cube[109] = cube_tmp[60];
        cube[110] = cube_tmp[61];
        cube[111] = cube_tmp[62];
        cube[112] = cube_tmp[63];
        cube[148] = cube_tmp[99];
        cube[149] = cube_tmp[100];
        cube[150] = cube_tmp[101];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[103];
        cube[153] = cube_tmp[104];
        cube[154] = cube_tmp[105];
        cube[155] = cube_tmp[106];
        cube[156] = cube_tmp[107];
        cube[157] = cube_tmp[108];
        cube[158] = cube_tmp[109];
        cube[159] = cube_tmp[110];
        cube[160] = cube_tmp[111];
        cube[161] = cube_tmp[112];
        cube[197] = cube_tmp[148];
        cube[198] = cube_tmp[149];
        cube[199] = cube_tmp[150];
        cube[200] = cube_tmp[151];
        cube[201] = cube_tmp[152];
        cube[202] = cube_tmp[153];
        cube[203] = cube_tmp[154];
        cube[204] = cube_tmp[155];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[157];
        cube[207] = cube_tmp[158];
        cube[208] = cube_tmp[159];
        cube[209] = cube_tmp[160];
        cube[210] = cube_tmp[161];
        break;

    case Uw2:
        cube[1] = cube_tmp[49];
        cube[2] = cube_tmp[48];
        cube[3] = cube_tmp[47];
        cube[4] = cube_tmp[46];
        cube[5] = cube_tmp[45];
        cube[6] = cube_tmp[44];
        cube[7] = cube_tmp[43];
        cube[8] = cube_tmp[42];
        cube[9] = cube_tmp[41];
        cube[10] = cube_tmp[40];
        cube[11] = cube_tmp[39];
        cube[12] = cube_tmp[38];
        cube[13] = cube_tmp[37];
        cube[14] = cube_tmp[36];
        cube[15] = cube_tmp[35];
        cube[16] = cube_tmp[34];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[32];
        cube[19] = cube_tmp[31];
        cube[20] = cube_tmp[30];
        cube[21] = cube_tmp[29];
        cube[22] = cube_tmp[28];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[26];
        cube[26] = cube_tmp[24];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[22];
        cube[29] = cube_tmp[21];
        cube[30] = cube_tmp[20];
        cube[31] = cube_tmp[19];
        cube[32] = cube_tmp[18];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[16];
        cube[35] = cube_tmp[15];
        cube[36] = cube_tmp[14];
        cube[37] = cube_tmp[13];
        cube[38] = cube_tmp[12];
        cube[39] = cube_tmp[11];
        cube[40] = cube_tmp[10];
        cube[41] = cube_tmp[9];
        cube[42] = cube_tmp[8];
        cube[43] = cube_tmp[7];
        cube[44] = cube_tmp[6];
        cube[45] = cube_tmp[5];
        cube[46] = cube_tmp[4];
        cube[47] = cube_tmp[3];
        cube[48] = cube_tmp[2];
        cube[49] = cube_tmp[1];
        cube[50] = cube_tmp[148];
        cube[51] = cube_tmp[149];
        cube[52] = cube_tmp[150];
        cube[53] = cube_tmp[151];
        cube[54] = cube_tmp[152];
        cube[55] = cube_tmp[153];
        cube[56] = cube_tmp[154];
        cube[57] = cube_tmp[155];
        cube[58] = cube_tmp[156];
        cube[59] = cube_tmp[157];
        cube[60] = cube_tmp[158];
        cube[61] = cube_tmp[159];
        cube[62] = cube_tmp[160];
        cube[63] = cube_tmp[161];
        cube[99] = cube_tmp[197];
        cube[100] = cube_tmp[198];
        cube[101] = cube_tmp[199];
        cube[102] = cube_tmp[200];
        cube[103] = cube_tmp[201];
        cube[104] = cube_tmp[202];
        cube[105] = cube_tmp[203];
        cube[106] = cube_tmp[204];
        cube[107] = cube_tmp[205];
        cube[108] = cube_tmp[206];
        cube[109] = cube_tmp[207];
        cube[110] = cube_tmp[208];
        cube[111] = cube_tmp[209];
        cube[112] = cube_tmp[210];
        cube[148] = cube_tmp[50];
        cube[149] = cube_tmp[51];
        cube[150] = cube_tmp[52];
        cube[151] = cube_tmp[53];
        cube[152] = cube_tmp[54];
        cube[153] = cube_tmp[55];
        cube[154] = cube_tmp[56];
        cube[155] = cube_tmp[57];
        cube[156] = cube_tmp[58];
        cube[157] = cube_tmp[59];
        cube[158] = cube_tmp[60];
        cube[159] = cube_tmp[61];
        cube[160] = cube_tmp[62];
        cube[161] = cube_tmp[63];
        cube[197] = cube_tmp[99];
        cube[198] = cube_tmp[100];
        cube[199] = cube_tmp[101];
        cube[200] = cube_tmp[102];
        cube[201] = cube_tmp[103];
        cube[202] = cube_tmp[104];
        cube[203] = cube_tmp[105];
        cube[204] = cube_tmp[106];
        cube[205] = cube_tmp[107];
        cube[206] = cube_tmp[108];
        cube[207] = cube_tmp[109];
        cube[208] = cube_tmp[110];
        cube[209] = cube_tmp[111];
        cube[210] = cube_tmp[112];
        break;

    case threeUw:
        cube[1] = cube_tmp[43];
        cube[2] = cube_tmp[36];
        cube[3] = cube_tmp[29];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[15];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[44];
        cube[9] = cube_tmp[37];
        cube[10] = cube_tmp[30];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[2];
        cube[15] = cube_tmp[45];
        cube[16] = cube_tmp[38];
        cube[17] = cube_tmp[31];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[10];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[46];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[32];
        cube[26] = cube_tmp[18];
        cube[27] = cube_tmp[11];
        cube[28] = cube_tmp[4];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[40];
        cube[31] = cube_tmp[33];
        cube[32] = cube_tmp[26];
        cube[33] = cube_tmp[19];
        cube[34] = cube_tmp[12];
        cube[35] = cube_tmp[5];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[41];
        cube[38] = cube_tmp[34];
        cube[39] = cube_tmp[27];
        cube[40] = cube_tmp[20];
        cube[41] = cube_tmp[13];
        cube[42] = cube_tmp[6];
        cube[43] = cube_tmp[49];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[35];
        cube[46] = cube_tmp[28];
        cube[47] = cube_tmp[21];
        cube[48] = cube_tmp[14];
        cube[49] = cube_tmp[7];
        cube[50] = cube_tmp[99];
        cube[51] = cube_tmp[100];
        cube[52] = cube_tmp[101];
        cube[53] = cube_tmp[102];
        cube[54] = cube_tmp[103];
        cube[55] = cube_tmp[104];
        cube[56] = cube_tmp[105];
        cube[57] = cube_tmp[106];
        cube[58] = cube_tmp[107];
        cube[59] = cube_tmp[108];
        cube[60] = cube_tmp[109];
        cube[61] = cube_tmp[110];
        cube[62] = cube_tmp[111];
        cube[63] = cube_tmp[112];
        cube[64] = cube_tmp[113];
        cube[65] = cube_tmp[114];
        cube[66] = cube_tmp[115];
        cube[67] = cube_tmp[116];
        cube[68] = cube_tmp[117];
        cube[69] = cube_tmp[118];
        cube[70] = cube_tmp[119];
        cube[99] = cube_tmp[148];
        cube[100] = cube_tmp[149];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[151];
        cube[103] = cube_tmp[152];
        cube[104] = cube_tmp[153];
        cube[105] = cube_tmp[154];
        cube[106] = cube_tmp[155];
        cube[107] = cube_tmp[156];
        cube[108] = cube_tmp[157];
        cube[109] = cube_tmp[158];
        cube[110] = cube_tmp[159];
        cube[111] = cube_tmp[160];
        cube[112] = cube_tmp[161];
        cube[113] = cube_tmp[162];
        cube[114] = cube_tmp[163];
        cube[115] = cube_tmp[164];
        cube[116] = cube_tmp[165];
        cube[117] = cube_tmp[166];
        cube[118] = cube_tmp[167];
        cube[119] = cube_tmp[168];
        cube[148] = cube_tmp[197];
        cube[149] = cube_tmp[198];
        cube[150] = cube_tmp[199];
        cube[151] = cube_tmp[200];
        cube[152] = cube_tmp[201];
        cube[153] = cube_tmp[202];
        cube[154] = cube_tmp[203];
        cube[155] = cube_tmp[204];
        cube[156] = cube_tmp[205];
        cube[157] = cube_tmp[206];
        cube[158] = cube_tmp[207];
        cube[159] = cube_tmp[208];
        cube[160] = cube_tmp[209];
        cube[161] = cube_tmp[210];
        cube[162] = cube_tmp[211];
        cube[163] = cube_tmp[212];
        cube[164] = cube_tmp[213];
        cube[165] = cube_tmp[214];
        cube[166] = cube_tmp[215];
        cube[167] = cube_tmp[216];
        cube[168] = cube_tmp[217];
        cube[197] = cube_tmp[50];
        cube[198] = cube_tmp[51];
        cube[199] = cube_tmp[52];
        cube[200] = cube_tmp[53];
        cube[201] = cube_tmp[54];
        cube[202] = cube_tmp[55];
        cube[203] = cube_tmp[56];
        cube[204] = cube_tmp[57];
        cube[205] = cube_tmp[58];
        cube[206] = cube_tmp[59];
        cube[207] = cube_tmp[60];
        cube[208] = cube_tmp[61];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[63];
        cube[211] = cube_tmp[64];
        cube[212] = cube_tmp[65];
        cube[213] = cube_tmp[66];
        cube[214] = cube_tmp[67];
        cube[215] = cube_tmp[68];
        cube[216] = cube_tmp[69];
        cube[217] = cube_tmp[70];
        break;

    case threeUw_PRIME:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[14];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[28];
        cube[5] = cube_tmp[35];
        cube[6] = cube_tmp[42];
        cube[7] = cube_tmp[49];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[20];
        cube[11] = cube_tmp[27];
        cube[12] = cube_tmp[34];
        cube[13] = cube_tmp[41];
        cube[14] = cube_tmp[48];
        cube[15] = cube_tmp[5];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[26];
        cube[19] = cube_tmp[33];
        cube[20] = cube_tmp[40];
        cube[21] = cube_tmp[47];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[18];
        cube[26] = cube_tmp[32];
        cube[27] = cube_tmp[39];
        cube[28] = cube_tmp[46];
        cube[29] = cube_tmp[3];
        cube[30] = cube_tmp[10];
        cube[31] = cube_tmp[17];
        cube[32] = cube_tmp[24];
        cube[33] = cube_tmp[31];
        cube[34] = cube_tmp[38];
        cube[35] = cube_tmp[45];
        cube[36] = cube_tmp[2];
        cube[37] = cube_tmp[9];
        cube[38] = cube_tmp[16];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[30];
        cube[41] = cube_tmp[37];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[1];
        cube[44] = cube_tmp[8];
        cube[45] = cube_tmp[15];
        cube[46] = cube_tmp[22];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[43];
        cube[50] = cube_tmp[197];
        cube[51] = cube_tmp[198];
        cube[52] = cube_tmp[199];
        cube[53] = cube_tmp[200];
        cube[54] = cube_tmp[201];
        cube[55] = cube_tmp[202];
        cube[56] = cube_tmp[203];
        cube[57] = cube_tmp[204];
        cube[58] = cube_tmp[205];
        cube[59] = cube_tmp[206];
        cube[60] = cube_tmp[207];
        cube[61] = cube_tmp[208];
        cube[62] = cube_tmp[209];
        cube[63] = cube_tmp[210];
        cube[64] = cube_tmp[211];
        cube[65] = cube_tmp[212];
        cube[66] = cube_tmp[213];
        cube[67] = cube_tmp[214];
        cube[68] = cube_tmp[215];
        cube[69] = cube_tmp[216];
        cube[70] = cube_tmp[217];
        cube[99] = cube_tmp[50];
        cube[100] = cube_tmp[51];
        cube[101] = cube_tmp[52];
        cube[102] = cube_tmp[53];
        cube[103] = cube_tmp[54];
        cube[104] = cube_tmp[55];
        cube[105] = cube_tmp[56];
        cube[106] = cube_tmp[57];
        cube[107] = cube_tmp[58];
        cube[108] = cube_tmp[59];
        cube[109] = cube_tmp[60];
        cube[110] = cube_tmp[61];
        cube[111] = cube_tmp[62];
        cube[112] = cube_tmp[63];
        cube[113] = cube_tmp[64];
        cube[114] = cube_tmp[65];
        cube[115] = cube_tmp[66];
        cube[116] = cube_tmp[67];
        cube[117] = cube_tmp[68];
        cube[118] = cube_tmp[69];
        cube[119] = cube_tmp[70];
        cube[148] = cube_tmp[99];
        cube[149] = cube_tmp[100];
        cube[150] = cube_tmp[101];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[103];
        cube[153] = cube_tmp[104];
        cube[154] = cube_tmp[105];
        cube[155] = cube_tmp[106];
        cube[156] = cube_tmp[107];
        cube[157] = cube_tmp[108];
        cube[158] = cube_tmp[109];
        cube[159] = cube_tmp[110];
        cube[160] = cube_tmp[111];
        cube[161] = cube_tmp[112];
        cube[162] = cube_tmp[113];
        cube[163] = cube_tmp[114];
        cube[164] = cube_tmp[115];
        cube[165] = cube_tmp[116];
        cube[166] = cube_tmp[117];
        cube[167] = cube_tmp[118];
        cube[168] = cube_tmp[119];
        cube[197] = cube_tmp[148];
        cube[198] = cube_tmp[149];
        cube[199] = cube_tmp[150];
        cube[200] = cube_tmp[151];
        cube[201] = cube_tmp[152];
        cube[202] = cube_tmp[153];
        cube[203] = cube_tmp[154];
        cube[204] = cube_tmp[155];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[157];
        cube[207] = cube_tmp[158];
        cube[208] = cube_tmp[159];
        cube[209] = cube_tmp[160];
        cube[210] = cube_tmp[161];
        cube[211] = cube_tmp[162];
        cube[212] = cube_tmp[163];
        cube[213] = cube_tmp[164];
        cube[214] = cube_tmp[165];
        cube[215] = cube_tmp[166];
        cube[216] = cube_tmp[167];
        cube[217] = cube_tmp[168];
        break;

    case threeUw2:
        cube[1] = cube_tmp[49];
        cube[2] = cube_tmp[48];
        cube[3] = cube_tmp[47];
        cube[4] = cube_tmp[46];
        cube[5] = cube_tmp[45];
        cube[6] = cube_tmp[44];
        cube[7] = cube_tmp[43];
        cube[8] = cube_tmp[42];
        cube[9] = cube_tmp[41];
        cube[10] = cube_tmp[40];
        cube[11] = cube_tmp[39];
        cube[12] = cube_tmp[38];
        cube[13] = cube_tmp[37];
        cube[14] = cube_tmp[36];
        cube[15] = cube_tmp[35];
        cube[16] = cube_tmp[34];
        cube[17] = cube_tmp[33];
        cube[18] = cube_tmp[32];
        cube[19] = cube_tmp[31];
        cube[20] = cube_tmp[30];
        cube[21] = cube_tmp[29];
        cube[22] = cube_tmp[28];
        cube[23] = cube_tmp[27];
        cube[24] = cube_tmp[26];
        cube[26] = cube_tmp[24];
        cube[27] = cube_tmp[23];
        cube[28] = cube_tmp[22];
        cube[29] = cube_tmp[21];
        cube[30] = cube_tmp[20];
        cube[31] = cube_tmp[19];
        cube[32] = cube_tmp[18];
        cube[33] = cube_tmp[17];
        cube[34] = cube_tmp[16];
        cube[35] = cube_tmp[15];
        cube[36] = cube_tmp[14];
        cube[37] = cube_tmp[13];
        cube[38] = cube_tmp[12];
        cube[39] = cube_tmp[11];
        cube[40] = cube_tmp[10];
        cube[41] = cube_tmp[9];
        cube[42] = cube_tmp[8];
        cube[43] = cube_tmp[7];
        cube[44] = cube_tmp[6];
        cube[45] = cube_tmp[5];
        cube[46] = cube_tmp[4];
        cube[47] = cube_tmp[3];
        cube[48] = cube_tmp[2];
        cube[49] = cube_tmp[1];
        cube[50] = cube_tmp[148];
        cube[51] = cube_tmp[149];
        cube[52] = cube_tmp[150];
        cube[53] = cube_tmp[151];
        cube[54] = cube_tmp[152];
        cube[55] = cube_tmp[153];
        cube[56] = cube_tmp[154];
        cube[57] = cube_tmp[155];
        cube[58] = cube_tmp[156];
        cube[59] = cube_tmp[157];
        cube[60] = cube_tmp[158];
        cube[61] = cube_tmp[159];
        cube[62] = cube_tmp[160];
        cube[63] = cube_tmp[161];
        cube[64] = cube_tmp[162];
        cube[65] = cube_tmp[163];
        cube[66] = cube_tmp[164];
        cube[67] = cube_tmp[165];
        cube[68] = cube_tmp[166];
        cube[69] = cube_tmp[167];
        cube[70] = cube_tmp[168];
        cube[99] = cube_tmp[197];
        cube[100] = cube_tmp[198];
        cube[101] = cube_tmp[199];
        cube[102] = cube_tmp[200];
        cube[103] = cube_tmp[201];
        cube[104] = cube_tmp[202];
        cube[105] = cube_tmp[203];
        cube[106] = cube_tmp[204];
        cube[107] = cube_tmp[205];
        cube[108] = cube_tmp[206];
        cube[109] = cube_tmp[207];
        cube[110] = cube_tmp[208];
        cube[111] = cube_tmp[209];
        cube[112] = cube_tmp[210];
        cube[113] = cube_tmp[211];
        cube[114] = cube_tmp[212];
        cube[115] = cube_tmp[213];
        cube[116] = cube_tmp[214];
        cube[117] = cube_tmp[215];
        cube[118] = cube_tmp[216];
        cube[119] = cube_tmp[217];
        cube[148] = cube_tmp[50];
        cube[149] = cube_tmp[51];
        cube[150] = cube_tmp[52];
        cube[151] = cube_tmp[53];
        cube[152] = cube_tmp[54];
        cube[153] = cube_tmp[55];
        cube[154] = cube_tmp[56];
        cube[155] = cube_tmp[57];
        cube[156] = cube_tmp[58];
        cube[157] = cube_tmp[59];
        cube[158] = cube_tmp[60];
        cube[159] = cube_tmp[61];
        cube[160] = cube_tmp[62];
        cube[161] = cube_tmp[63];
        cube[162] = cube_tmp[64];
        cube[163] = cube_tmp[65];
        cube[164] = cube_tmp[66];
        cube[165] = cube_tmp[67];
        cube[166] = cube_tmp[68];
        cube[167] = cube_tmp[69];
        cube[168] = cube_tmp[70];
        cube[197] = cube_tmp[99];
        cube[198] = cube_tmp[100];
        cube[199] = cube_tmp[101];
        cube[200] = cube_tmp[102];
        cube[201] = cube_tmp[103];
        cube[202] = cube_tmp[104];
        cube[203] = cube_tmp[105];
        cube[204] = cube_tmp[106];
        cube[205] = cube_tmp[107];
        cube[206] = cube_tmp[108];
        cube[207] = cube_tmp[109];
        cube[208] = cube_tmp[110];
        cube[209] = cube_tmp[111];
        cube[210] = cube_tmp[112];
        cube[211] = cube_tmp[113];
        cube[212] = cube_tmp[114];
        cube[213] = cube_tmp[115];
        cube[214] = cube_tmp[116];
        cube[215] = cube_tmp[117];
        cube[216] = cube_tmp[118];
        cube[217] = cube_tmp[119];
        break;

    case L:
        cube[1] = cube_tmp[245];
        cube[8] = cube_tmp[238];
        cube[15] = cube_tmp[231];
        cube[22] = cube_tmp[224];
        cube[29] = cube_tmp[217];
        cube[36] = cube_tmp[210];
        cube[43] = cube_tmp[203];
        cube[50] = cube_tmp[92];
        cube[51] = cube_tmp[85];
        cube[52] = cube_tmp[78];
        cube[53] = cube_tmp[71];
        cube[54] = cube_tmp[64];
        cube[55] = cube_tmp[57];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[86];
        cube[59] = cube_tmp[79];
        cube[60] = cube_tmp[72];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[58];
        cube[63] = cube_tmp[51];
        cube[64] = cube_tmp[94];
        cube[65] = cube_tmp[87];
        cube[66] = cube_tmp[80];
        cube[67] = cube_tmp[73];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[52];
        cube[71] = cube_tmp[95];
        cube[72] = cube_tmp[88];
        cube[73] = cube_tmp[81];
        cube[75] = cube_tmp[67];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[53];
        cube[78] = cube_tmp[96];
        cube[79] = cube_tmp[89];
        cube[80] = cube_tmp[82];
        cube[81] = cube_tmp[75];
        cube[82] = cube_tmp[68];
        cube[83] = cube_tmp[61];
        cube[84] = cube_tmp[54];
        cube[85] = cube_tmp[97];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[83];
        cube[88] = cube_tmp[76];
        cube[89] = cube_tmp[69];
        cube[90] = cube_tmp[62];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[98];
        cube[93] = cube_tmp[91];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[77];
        cube[96] = cube_tmp[70];
        cube[97] = cube_tmp[63];
        cube[98] = cube_tmp[56];
        cube[99] = cube_tmp[1];
        cube[106] = cube_tmp[8];
        cube[113] = cube_tmp[15];
        cube[120] = cube_tmp[22];
        cube[127] = cube_tmp[29];
        cube[134] = cube_tmp[36];
        cube[141] = cube_tmp[43];
        cube[203] = cube_tmp[288];
        cube[210] = cube_tmp[281];
        cube[217] = cube_tmp[274];
        cube[224] = cube_tmp[267];
        cube[231] = cube_tmp[260];
        cube[238] = cube_tmp[253];
        cube[245] = cube_tmp[246];
        cube[246] = cube_tmp[99];
        cube[253] = cube_tmp[106];
        cube[260] = cube_tmp[113];
        cube[267] = cube_tmp[120];
        cube[274] = cube_tmp[127];
        cube[281] = cube_tmp[134];
        cube[288] = cube_tmp[141];
        break;

    case L_PRIME:
        cube[1] = cube_tmp[99];
        cube[8] = cube_tmp[106];
        cube[15] = cube_tmp[113];
        cube[22] = cube_tmp[120];
        cube[29] = cube_tmp[127];
        cube[36] = cube_tmp[134];
        cube[43] = cube_tmp[141];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[63];
        cube[52] = cube_tmp[70];
        cube[53] = cube_tmp[77];
        cube[54] = cube_tmp[84];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[98];
        cube[57] = cube_tmp[55];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[83];
        cube[62] = cube_tmp[90];
        cube[63] = cube_tmp[97];
        cube[64] = cube_tmp[54];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[75];
        cube[68] = cube_tmp[82];
        cube[69] = cube_tmp[89];
        cube[70] = cube_tmp[96];
        cube[71] = cube_tmp[53];
        cube[72] = cube_tmp[60];
        cube[73] = cube_tmp[67];
        cube[75] = cube_tmp[81];
        cube[76] = cube_tmp[88];
        cube[77] = cube_tmp[95];
        cube[78] = cube_tmp[52];
        cube[79] = cube_tmp[59];
        cube[80] = cube_tmp[66];
        cube[81] = cube_tmp[73];
        cube[82] = cube_tmp[80];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[51];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[65];
        cube[88] = cube_tmp[72];
        cube[89] = cube_tmp[79];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[93];
        cube[92] = cube_tmp[50];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[64];
        cube[95] = cube_tmp[71];
        cube[96] = cube_tmp[78];
        cube[97] = cube_tmp[85];
        cube[98] = cube_tmp[92];
        cube[99] = cube_tmp[246];
        cube[106] = cube_tmp[253];
        cube[113] = cube_tmp[260];
        cube[120] = cube_tmp[267];
        cube[127] = cube_tmp[274];
        cube[134] = cube_tmp[281];
        cube[141] = cube_tmp[288];
        cube[203] = cube_tmp[43];
        cube[210] = cube_tmp[36];
        cube[217] = cube_tmp[29];
        cube[224] = cube_tmp[22];
        cube[231] = cube_tmp[15];
        cube[238] = cube_tmp[8];
        cube[245] = cube_tmp[1];
        cube[246] = cube_tmp[245];
        cube[253] = cube_tmp[238];
        cube[260] = cube_tmp[231];
        cube[267] = cube_tmp[224];
        cube[274] = cube_tmp[217];
        cube[281] = cube_tmp[210];
        cube[288] = cube_tmp[203];
        break;

    case L2:
        cube[1] = cube_tmp[246];
        cube[8] = cube_tmp[253];
        cube[15] = cube_tmp[260];
        cube[22] = cube_tmp[267];
        cube[29] = cube_tmp[274];
        cube[36] = cube_tmp[281];
        cube[43] = cube_tmp[288];
        cube[50] = cube_tmp[98];
        cube[51] = cube_tmp[97];
        cube[52] = cube_tmp[96];
        cube[53] = cube_tmp[95];
        cube[54] = cube_tmp[94];
        cube[55] = cube_tmp[93];
        cube[56] = cube_tmp[92];
        cube[57] = cube_tmp[91];
        cube[58] = cube_tmp[90];
        cube[59] = cube_tmp[89];
        cube[60] = cube_tmp[88];
        cube[61] = cube_tmp[87];
        cube[62] = cube_tmp[86];
        cube[63] = cube_tmp[85];
        cube[64] = cube_tmp[84];
        cube[65] = cube_tmp[83];
        cube[66] = cube_tmp[82];
        cube[67] = cube_tmp[81];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[79];
        cube[70] = cube_tmp[78];
        cube[71] = cube_tmp[77];
        cube[72] = cube_tmp[76];
        cube[73] = cube_tmp[75];
        cube[75] = cube_tmp[73];
        cube[76] = cube_tmp[72];
        cube[77] = cube_tmp[71];
        cube[78] = cube_tmp[70];
        cube[79] = cube_tmp[69];
        cube[80] = cube_tmp[68];
        cube[81] = cube_tmp[67];
        cube[82] = cube_tmp[66];
        cube[83] = cube_tmp[65];
        cube[84] = cube_tmp[64];
        cube[85] = cube_tmp[63];
        cube[86] = cube_tmp[62];
        cube[87] = cube_tmp[61];
        cube[88] = cube_tmp[60];
        cube[89] = cube_tmp[59];
        cube[90] = cube_tmp[58];
        cube[91] = cube_tmp[57];
        cube[92] = cube_tmp[56];
        cube[93] = cube_tmp[55];
        cube[94] = cube_tmp[54];
        cube[95] = cube_tmp[53];
        cube[96] = cube_tmp[52];
        cube[97] = cube_tmp[51];
        cube[98] = cube_tmp[50];
        cube[99] = cube_tmp[245];
        cube[106] = cube_tmp[238];
        cube[113] = cube_tmp[231];
        cube[120] = cube_tmp[224];
        cube[127] = cube_tmp[217];
        cube[134] = cube_tmp[210];
        cube[141] = cube_tmp[203];
        cube[203] = cube_tmp[141];
        cube[210] = cube_tmp[134];
        cube[217] = cube_tmp[127];
        cube[224] = cube_tmp[120];
        cube[231] = cube_tmp[113];
        cube[238] = cube_tmp[106];
        cube[245] = cube_tmp[99];
        cube[246] = cube_tmp[1];
        cube[253] = cube_tmp[8];
        cube[260] = cube_tmp[15];
        cube[267] = cube_tmp[22];
        cube[274] = cube_tmp[29];
        cube[281] = cube_tmp[36];
        cube[288] = cube_tmp[43];
        break;

    case Lw:
        cube[1] = cube_tmp[245];
        cube[2] = cube_tmp[244];
        cube[8] = cube_tmp[238];
        cube[9] = cube_tmp[237];
        cube[15] = cube_tmp[231];
        cube[16] = cube_tmp[230];
        cube[22] = cube_tmp[224];
        cube[23] = cube_tmp[223];
        cube[29] = cube_tmp[217];
        cube[30] = cube_tmp[216];
        cube[36] = cube_tmp[210];
        cube[37] = cube_tmp[209];
        cube[43] = cube_tmp[203];
        cube[44] = cube_tmp[202];
        cube[50] = cube_tmp[92];
        cube[51] = cube_tmp[85];
        cube[52] = cube_tmp[78];
        cube[53] = cube_tmp[71];
        cube[54] = cube_tmp[64];
        cube[55] = cube_tmp[57];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[86];
        cube[59] = cube_tmp[79];
        cube[60] = cube_tmp[72];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[58];
        cube[63] = cube_tmp[51];
        cube[64] = cube_tmp[94];
        cube[65] = cube_tmp[87];
        cube[66] = cube_tmp[80];
        cube[67] = cube_tmp[73];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[52];
        cube[71] = cube_tmp[95];
        cube[72] = cube_tmp[88];
        cube[73] = cube_tmp[81];
        cube[75] = cube_tmp[67];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[53];
        cube[78] = cube_tmp[96];
        cube[79] = cube_tmp[89];
        cube[80] = cube_tmp[82];
        cube[81] = cube_tmp[75];
        cube[82] = cube_tmp[68];
        cube[83] = cube_tmp[61];
        cube[84] = cube_tmp[54];
        cube[85] = cube_tmp[97];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[83];
        cube[88] = cube_tmp[76];
        cube[89] = cube_tmp[69];
        cube[90] = cube_tmp[62];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[98];
        cube[93] = cube_tmp[91];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[77];
        cube[96] = cube_tmp[70];
        cube[97] = cube_tmp[63];
        cube[98] = cube_tmp[56];
        cube[99] = cube_tmp[1];
        cube[100] = cube_tmp[2];
        cube[106] = cube_tmp[8];
        cube[107] = cube_tmp[9];
        cube[113] = cube_tmp[15];
        cube[114] = cube_tmp[16];
        cube[120] = cube_tmp[22];
        cube[121] = cube_tmp[23];
        cube[127] = cube_tmp[29];
        cube[128] = cube_tmp[30];
        cube[134] = cube_tmp[36];
        cube[135] = cube_tmp[37];
        cube[141] = cube_tmp[43];
        cube[142] = cube_tmp[44];
        cube[202] = cube_tmp[289];
        cube[203] = cube_tmp[288];
        cube[209] = cube_tmp[282];
        cube[210] = cube_tmp[281];
        cube[216] = cube_tmp[275];
        cube[217] = cube_tmp[274];
        cube[223] = cube_tmp[268];
        cube[224] = cube_tmp[267];
        cube[230] = cube_tmp[261];
        cube[231] = cube_tmp[260];
        cube[237] = cube_tmp[254];
        cube[238] = cube_tmp[253];
        cube[244] = cube_tmp[247];
        cube[245] = cube_tmp[246];
        cube[246] = cube_tmp[99];
        cube[247] = cube_tmp[100];
        cube[253] = cube_tmp[106];
        cube[254] = cube_tmp[107];
        cube[260] = cube_tmp[113];
        cube[261] = cube_tmp[114];
        cube[267] = cube_tmp[120];
        cube[268] = cube_tmp[121];
        cube[274] = cube_tmp[127];
        cube[275] = cube_tmp[128];
        cube[281] = cube_tmp[134];
        cube[282] = cube_tmp[135];
        cube[288] = cube_tmp[141];
        cube[289] = cube_tmp[142];
        break;

    case Lw_PRIME:
        cube[1] = cube_tmp[99];
        cube[2] = cube_tmp[100];
        cube[8] = cube_tmp[106];
        cube[9] = cube_tmp[107];
        cube[15] = cube_tmp[113];
        cube[16] = cube_tmp[114];
        cube[22] = cube_tmp[120];
        cube[23] = cube_tmp[121];
        cube[29] = cube_tmp[127];
        cube[30] = cube_tmp[128];
        cube[36] = cube_tmp[134];
        cube[37] = cube_tmp[135];
        cube[43] = cube_tmp[141];
        cube[44] = cube_tmp[142];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[63];
        cube[52] = cube_tmp[70];
        cube[53] = cube_tmp[77];
        cube[54] = cube_tmp[84];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[98];
        cube[57] = cube_tmp[55];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[83];
        cube[62] = cube_tmp[90];
        cube[63] = cube_tmp[97];
        cube[64] = cube_tmp[54];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[75];
        cube[68] = cube_tmp[82];
        cube[69] = cube_tmp[89];
        cube[70] = cube_tmp[96];
        cube[71] = cube_tmp[53];
        cube[72] = cube_tmp[60];
        cube[73] = cube_tmp[67];
        cube[75] = cube_tmp[81];
        cube[76] = cube_tmp[88];
        cube[77] = cube_tmp[95];
        cube[78] = cube_tmp[52];
        cube[79] = cube_tmp[59];
        cube[80] = cube_tmp[66];
        cube[81] = cube_tmp[73];
        cube[82] = cube_tmp[80];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[51];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[65];
        cube[88] = cube_tmp[72];
        cube[89] = cube_tmp[79];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[93];
        cube[92] = cube_tmp[50];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[64];
        cube[95] = cube_tmp[71];
        cube[96] = cube_tmp[78];
        cube[97] = cube_tmp[85];
        cube[98] = cube_tmp[92];
        cube[99] = cube_tmp[246];
        cube[100] = cube_tmp[247];
        cube[106] = cube_tmp[253];
        cube[107] = cube_tmp[254];
        cube[113] = cube_tmp[260];
        cube[114] = cube_tmp[261];
        cube[120] = cube_tmp[267];
        cube[121] = cube_tmp[268];
        cube[127] = cube_tmp[274];
        cube[128] = cube_tmp[275];
        cube[134] = cube_tmp[281];
        cube[135] = cube_tmp[282];
        cube[141] = cube_tmp[288];
        cube[142] = cube_tmp[289];
        cube[202] = cube_tmp[44];
        cube[203] = cube_tmp[43];
        cube[209] = cube_tmp[37];
        cube[210] = cube_tmp[36];
        cube[216] = cube_tmp[30];
        cube[217] = cube_tmp[29];
        cube[223] = cube_tmp[23];
        cube[224] = cube_tmp[22];
        cube[230] = cube_tmp[16];
        cube[231] = cube_tmp[15];
        cube[237] = cube_tmp[9];
        cube[238] = cube_tmp[8];
        cube[244] = cube_tmp[2];
        cube[245] = cube_tmp[1];
        cube[246] = cube_tmp[245];
        cube[247] = cube_tmp[244];
        cube[253] = cube_tmp[238];
        cube[254] = cube_tmp[237];
        cube[260] = cube_tmp[231];
        cube[261] = cube_tmp[230];
        cube[267] = cube_tmp[224];
        cube[268] = cube_tmp[223];
        cube[274] = cube_tmp[217];
        cube[275] = cube_tmp[216];
        cube[281] = cube_tmp[210];
        cube[282] = cube_tmp[209];
        cube[288] = cube_tmp[203];
        cube[289] = cube_tmp[202];
        break;

    case Lw2:
        cube[1] = cube_tmp[246];
        cube[2] = cube_tmp[247];
        cube[8] = cube_tmp[253];
        cube[9] = cube_tmp[254];
        cube[15] = cube_tmp[260];
        cube[16] = cube_tmp[261];
        cube[22] = cube_tmp[267];
        cube[23] = cube_tmp[268];
        cube[29] = cube_tmp[274];
        cube[30] = cube_tmp[275];
        cube[36] = cube_tmp[281];
        cube[37] = cube_tmp[282];
        cube[43] = cube_tmp[288];
        cube[44] = cube_tmp[289];
        cube[50] = cube_tmp[98];
        cube[51] = cube_tmp[97];
        cube[52] = cube_tmp[96];
        cube[53] = cube_tmp[95];
        cube[54] = cube_tmp[94];
        cube[55] = cube_tmp[93];
        cube[56] = cube_tmp[92];
        cube[57] = cube_tmp[91];
        cube[58] = cube_tmp[90];
        cube[59] = cube_tmp[89];
        cube[60] = cube_tmp[88];
        cube[61] = cube_tmp[87];
        cube[62] = cube_tmp[86];
        cube[63] = cube_tmp[85];
        cube[64] = cube_tmp[84];
        cube[65] = cube_tmp[83];
        cube[66] = cube_tmp[82];
        cube[67] = cube_tmp[81];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[79];
        cube[70] = cube_tmp[78];
        cube[71] = cube_tmp[77];
        cube[72] = cube_tmp[76];
        cube[73] = cube_tmp[75];
        cube[75] = cube_tmp[73];
        cube[76] = cube_tmp[72];
        cube[77] = cube_tmp[71];
        cube[78] = cube_tmp[70];
        cube[79] = cube_tmp[69];
        cube[80] = cube_tmp[68];
        cube[81] = cube_tmp[67];
        cube[82] = cube_tmp[66];
        cube[83] = cube_tmp[65];
        cube[84] = cube_tmp[64];
        cube[85] = cube_tmp[63];
        cube[86] = cube_tmp[62];
        cube[87] = cube_tmp[61];
        cube[88] = cube_tmp[60];
        cube[89] = cube_tmp[59];
        cube[90] = cube_tmp[58];
        cube[91] = cube_tmp[57];
        cube[92] = cube_tmp[56];
        cube[93] = cube_tmp[55];
        cube[94] = cube_tmp[54];
        cube[95] = cube_tmp[53];
        cube[96] = cube_tmp[52];
        cube[97] = cube_tmp[51];
        cube[98] = cube_tmp[50];
        cube[99] = cube_tmp[245];
        cube[100] = cube_tmp[244];
        cube[106] = cube_tmp[238];
        cube[107] = cube_tmp[237];
        cube[113] = cube_tmp[231];
        cube[114] = cube_tmp[230];
        cube[120] = cube_tmp[224];
        cube[121] = cube_tmp[223];
        cube[127] = cube_tmp[217];
        cube[128] = cube_tmp[216];
        cube[134] = cube_tmp[210];
        cube[135] = cube_tmp[209];
        cube[141] = cube_tmp[203];
        cube[142] = cube_tmp[202];
        cube[202] = cube_tmp[142];
        cube[203] = cube_tmp[141];
        cube[209] = cube_tmp[135];
        cube[210] = cube_tmp[134];
        cube[216] = cube_tmp[128];
        cube[217] = cube_tmp[127];
        cube[223] = cube_tmp[121];
        cube[224] = cube_tmp[120];
        cube[230] = cube_tmp[114];
        cube[231] = cube_tmp[113];
        cube[237] = cube_tmp[107];
        cube[238] = cube_tmp[106];
        cube[244] = cube_tmp[100];
        cube[245] = cube_tmp[99];
        cube[246] = cube_tmp[1];
        cube[247] = cube_tmp[2];
        cube[253] = cube_tmp[8];
        cube[254] = cube_tmp[9];
        cube[260] = cube_tmp[15];
        cube[261] = cube_tmp[16];
        cube[267] = cube_tmp[22];
        cube[268] = cube_tmp[23];
        cube[274] = cube_tmp[29];
        cube[275] = cube_tmp[30];
        cube[281] = cube_tmp[36];
        cube[282] = cube_tmp[37];
        cube[288] = cube_tmp[43];
        cube[289] = cube_tmp[44];
        break;

    case threeLw:
        cube[1] = cube_tmp[245];
        cube[2] = cube_tmp[244];
        cube[3] = cube_tmp[243];
        cube[8] = cube_tmp[238];
        cube[9] = cube_tmp[237];
        cube[10] = cube_tmp[236];
        cube[15] = cube_tmp[231];
        cube[16] = cube_tmp[230];
        cube[17] = cube_tmp[229];
        cube[22] = cube_tmp[224];
        cube[23] = cube_tmp[223];
        cube[24] = cube_tmp[222];
        cube[29] = cube_tmp[217];
        cube[30] = cube_tmp[216];
        cube[31] = cube_tmp[215];
        cube[36] = cube_tmp[210];
        cube[37] = cube_tmp[209];
        cube[38] = cube_tmp[208];
        cube[43] = cube_tmp[203];
        cube[44] = cube_tmp[202];
        cube[45] = cube_tmp[201];
        cube[50] = cube_tmp[92];
        cube[51] = cube_tmp[85];
        cube[52] = cube_tmp[78];
        cube[53] = cube_tmp[71];
        cube[54] = cube_tmp[64];
        cube[55] = cube_tmp[57];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[86];
        cube[59] = cube_tmp[79];
        cube[60] = cube_tmp[72];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[58];
        cube[63] = cube_tmp[51];
        cube[64] = cube_tmp[94];
        cube[65] = cube_tmp[87];
        cube[66] = cube_tmp[80];
        cube[67] = cube_tmp[73];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[52];
        cube[71] = cube_tmp[95];
        cube[72] = cube_tmp[88];
        cube[73] = cube_tmp[81];
        cube[75] = cube_tmp[67];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[53];
        cube[78] = cube_tmp[96];
        cube[79] = cube_tmp[89];
        cube[80] = cube_tmp[82];
        cube[81] = cube_tmp[75];
        cube[82] = cube_tmp[68];
        cube[83] = cube_tmp[61];
        cube[84] = cube_tmp[54];
        cube[85] = cube_tmp[97];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[83];
        cube[88] = cube_tmp[76];
        cube[89] = cube_tmp[69];
        cube[90] = cube_tmp[62];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[98];
        cube[93] = cube_tmp[91];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[77];
        cube[96] = cube_tmp[70];
        cube[97] = cube_tmp[63];
        cube[98] = cube_tmp[56];
        cube[99] = cube_tmp[1];
        cube[100] = cube_tmp[2];
        cube[101] = cube_tmp[3];
        cube[106] = cube_tmp[8];
        cube[107] = cube_tmp[9];
        cube[108] = cube_tmp[10];
        cube[113] = cube_tmp[15];
        cube[114] = cube_tmp[16];
        cube[115] = cube_tmp[17];
        cube[120] = cube_tmp[22];
        cube[121] = cube_tmp[23];
        cube[122] = cube_tmp[24];
        cube[127] = cube_tmp[29];
        cube[128] = cube_tmp[30];
        cube[129] = cube_tmp[31];
        cube[134] = cube_tmp[36];
        cube[135] = cube_tmp[37];
        cube[136] = cube_tmp[38];
        cube[141] = cube_tmp[43];
        cube[142] = cube_tmp[44];
        cube[143] = cube_tmp[45];
        cube[201] = cube_tmp[290];
        cube[202] = cube_tmp[289];
        cube[203] = cube_tmp[288];
        cube[208] = cube_tmp[283];
        cube[209] = cube_tmp[282];
        cube[210] = cube_tmp[281];
        cube[215] = cube_tmp[276];
        cube[216] = cube_tmp[275];
        cube[217] = cube_tmp[274];
        cube[222] = cube_tmp[269];
        cube[223] = cube_tmp[268];
        cube[224] = cube_tmp[267];
        cube[229] = cube_tmp[262];
        cube[230] = cube_tmp[261];
        cube[231] = cube_tmp[260];
        cube[236] = cube_tmp[255];
        cube[237] = cube_tmp[254];
        cube[238] = cube_tmp[253];
        cube[243] = cube_tmp[248];
        cube[244] = cube_tmp[247];
        cube[245] = cube_tmp[246];
        cube[246] = cube_tmp[99];
        cube[247] = cube_tmp[100];
        cube[248] = cube_tmp[101];
        cube[253] = cube_tmp[106];
        cube[254] = cube_tmp[107];
        cube[255] = cube_tmp[108];
        cube[260] = cube_tmp[113];
        cube[261] = cube_tmp[114];
        cube[262] = cube_tmp[115];
        cube[267] = cube_tmp[120];
        cube[268] = cube_tmp[121];
        cube[269] = cube_tmp[122];
        cube[274] = cube_tmp[127];
        cube[275] = cube_tmp[128];
        cube[276] = cube_tmp[129];
        cube[281] = cube_tmp[134];
        cube[282] = cube_tmp[135];
        cube[283] = cube_tmp[136];
        cube[288] = cube_tmp[141];
        cube[289] = cube_tmp[142];
        cube[290] = cube_tmp[143];
        break;

    case threeLw_PRIME:
        cube[1] = cube_tmp[99];
        cube[2] = cube_tmp[100];
        cube[3] = cube_tmp[101];
        cube[8] = cube_tmp[106];
        cube[9] = cube_tmp[107];
        cube[10] = cube_tmp[108];
        cube[15] = cube_tmp[113];
        cube[16] = cube_tmp[114];
        cube[17] = cube_tmp[115];
        cube[22] = cube_tmp[120];
        cube[23] = cube_tmp[121];
        cube[24] = cube_tmp[122];
        cube[29] = cube_tmp[127];
        cube[30] = cube_tmp[128];
        cube[31] = cube_tmp[129];
        cube[36] = cube_tmp[134];
        cube[37] = cube_tmp[135];
        cube[38] = cube_tmp[136];
        cube[43] = cube_tmp[141];
        cube[44] = cube_tmp[142];
        cube[45] = cube_tmp[143];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[63];
        cube[52] = cube_tmp[70];
        cube[53] = cube_tmp[77];
        cube[54] = cube_tmp[84];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[98];
        cube[57] = cube_tmp[55];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[83];
        cube[62] = cube_tmp[90];
        cube[63] = cube_tmp[97];
        cube[64] = cube_tmp[54];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[75];
        cube[68] = cube_tmp[82];
        cube[69] = cube_tmp[89];
        cube[70] = cube_tmp[96];
        cube[71] = cube_tmp[53];
        cube[72] = cube_tmp[60];
        cube[73] = cube_tmp[67];
        cube[75] = cube_tmp[81];
        cube[76] = cube_tmp[88];
        cube[77] = cube_tmp[95];
        cube[78] = cube_tmp[52];
        cube[79] = cube_tmp[59];
        cube[80] = cube_tmp[66];
        cube[81] = cube_tmp[73];
        cube[82] = cube_tmp[80];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[51];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[65];
        cube[88] = cube_tmp[72];
        cube[89] = cube_tmp[79];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[93];
        cube[92] = cube_tmp[50];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[64];
        cube[95] = cube_tmp[71];
        cube[96] = cube_tmp[78];
        cube[97] = cube_tmp[85];
        cube[98] = cube_tmp[92];
        cube[99] = cube_tmp[246];
        cube[100] = cube_tmp[247];
        cube[101] = cube_tmp[248];
        cube[106] = cube_tmp[253];
        cube[107] = cube_tmp[254];
        cube[108] = cube_tmp[255];
        cube[113] = cube_tmp[260];
        cube[114] = cube_tmp[261];
        cube[115] = cube_tmp[262];
        cube[120] = cube_tmp[267];
        cube[121] = cube_tmp[268];
        cube[122] = cube_tmp[269];
        cube[127] = cube_tmp[274];
        cube[128] = cube_tmp[275];
        cube[129] = cube_tmp[276];
        cube[134] = cube_tmp[281];
        cube[135] = cube_tmp[282];
        cube[136] = cube_tmp[283];
        cube[141] = cube_tmp[288];
        cube[142] = cube_tmp[289];
        cube[143] = cube_tmp[290];
        cube[201] = cube_tmp[45];
        cube[202] = cube_tmp[44];
        cube[203] = cube_tmp[43];
        cube[208] = cube_tmp[38];
        cube[209] = cube_tmp[37];
        cube[210] = cube_tmp[36];
        cube[215] = cube_tmp[31];
        cube[216] = cube_tmp[30];
        cube[217] = cube_tmp[29];
        cube[222] = cube_tmp[24];
        cube[223] = cube_tmp[23];
        cube[224] = cube_tmp[22];
        cube[229] = cube_tmp[17];
        cube[230] = cube_tmp[16];
        cube[231] = cube_tmp[15];
        cube[236] = cube_tmp[10];
        cube[237] = cube_tmp[9];
        cube[238] = cube_tmp[8];
        cube[243] = cube_tmp[3];
        cube[244] = cube_tmp[2];
        cube[245] = cube_tmp[1];
        cube[246] = cube_tmp[245];
        cube[247] = cube_tmp[244];
        cube[248] = cube_tmp[243];
        cube[253] = cube_tmp[238];
        cube[254] = cube_tmp[237];
        cube[255] = cube_tmp[236];
        cube[260] = cube_tmp[231];
        cube[261] = cube_tmp[230];
        cube[262] = cube_tmp[229];
        cube[267] = cube_tmp[224];
        cube[268] = cube_tmp[223];
        cube[269] = cube_tmp[222];
        cube[274] = cube_tmp[217];
        cube[275] = cube_tmp[216];
        cube[276] = cube_tmp[215];
        cube[281] = cube_tmp[210];
        cube[282] = cube_tmp[209];
        cube[283] = cube_tmp[208];
        cube[288] = cube_tmp[203];
        cube[289] = cube_tmp[202];
        cube[290] = cube_tmp[201];
        break;

    case threeLw2:
        cube[1] = cube_tmp[246];
        cube[2] = cube_tmp[247];
        cube[3] = cube_tmp[248];
        cube[8] = cube_tmp[253];
        cube[9] = cube_tmp[254];
        cube[10] = cube_tmp[255];
        cube[15] = cube_tmp[260];
        cube[16] = cube_tmp[261];
        cube[17] = cube_tmp[262];
        cube[22] = cube_tmp[267];
        cube[23] = cube_tmp[268];
        cube[24] = cube_tmp[269];
        cube[29] = cube_tmp[274];
        cube[30] = cube_tmp[275];
        cube[31] = cube_tmp[276];
        cube[36] = cube_tmp[281];
        cube[37] = cube_tmp[282];
        cube[38] = cube_tmp[283];
        cube[43] = cube_tmp[288];
        cube[44] = cube_tmp[289];
        cube[45] = cube_tmp[290];
        cube[50] = cube_tmp[98];
        cube[51] = cube_tmp[97];
        cube[52] = cube_tmp[96];
        cube[53] = cube_tmp[95];
        cube[54] = cube_tmp[94];
        cube[55] = cube_tmp[93];
        cube[56] = cube_tmp[92];
        cube[57] = cube_tmp[91];
        cube[58] = cube_tmp[90];
        cube[59] = cube_tmp[89];
        cube[60] = cube_tmp[88];
        cube[61] = cube_tmp[87];
        cube[62] = cube_tmp[86];
        cube[63] = cube_tmp[85];
        cube[64] = cube_tmp[84];
        cube[65] = cube_tmp[83];
        cube[66] = cube_tmp[82];
        cube[67] = cube_tmp[81];
        cube[68] = cube_tmp[80];
        cube[69] = cube_tmp[79];
        cube[70] = cube_tmp[78];
        cube[71] = cube_tmp[77];
        cube[72] = cube_tmp[76];
        cube[73] = cube_tmp[75];
        cube[75] = cube_tmp[73];
        cube[76] = cube_tmp[72];
        cube[77] = cube_tmp[71];
        cube[78] = cube_tmp[70];
        cube[79] = cube_tmp[69];
        cube[80] = cube_tmp[68];
        cube[81] = cube_tmp[67];
        cube[82] = cube_tmp[66];
        cube[83] = cube_tmp[65];
        cube[84] = cube_tmp[64];
        cube[85] = cube_tmp[63];
        cube[86] = cube_tmp[62];
        cube[87] = cube_tmp[61];
        cube[88] = cube_tmp[60];
        cube[89] = cube_tmp[59];
        cube[90] = cube_tmp[58];
        cube[91] = cube_tmp[57];
        cube[92] = cube_tmp[56];
        cube[93] = cube_tmp[55];
        cube[94] = cube_tmp[54];
        cube[95] = cube_tmp[53];
        cube[96] = cube_tmp[52];
        cube[97] = cube_tmp[51];
        cube[98] = cube_tmp[50];
        cube[99] = cube_tmp[245];
        cube[100] = cube_tmp[244];
        cube[101] = cube_tmp[243];
        cube[106] = cube_tmp[238];
        cube[107] = cube_tmp[237];
        cube[108] = cube_tmp[236];
        cube[113] = cube_tmp[231];
        cube[114] = cube_tmp[230];
        cube[115] = cube_tmp[229];
        cube[120] = cube_tmp[224];
        cube[121] = cube_tmp[223];
        cube[122] = cube_tmp[222];
        cube[127] = cube_tmp[217];
        cube[128] = cube_tmp[216];
        cube[129] = cube_tmp[215];
        cube[134] = cube_tmp[210];
        cube[135] = cube_tmp[209];
        cube[136] = cube_tmp[208];
        cube[141] = cube_tmp[203];
        cube[142] = cube_tmp[202];
        cube[143] = cube_tmp[201];
        cube[201] = cube_tmp[143];
        cube[202] = cube_tmp[142];
        cube[203] = cube_tmp[141];
        cube[208] = cube_tmp[136];
        cube[209] = cube_tmp[135];
        cube[210] = cube_tmp[134];
        cube[215] = cube_tmp[129];
        cube[216] = cube_tmp[128];
        cube[217] = cube_tmp[127];
        cube[222] = cube_tmp[122];
        cube[223] = cube_tmp[121];
        cube[224] = cube_tmp[120];
        cube[229] = cube_tmp[115];
        cube[230] = cube_tmp[114];
        cube[231] = cube_tmp[113];
        cube[236] = cube_tmp[108];
        cube[237] = cube_tmp[107];
        cube[238] = cube_tmp[106];
        cube[243] = cube_tmp[101];
        cube[244] = cube_tmp[100];
        cube[245] = cube_tmp[99];
        cube[246] = cube_tmp[1];
        cube[247] = cube_tmp[2];
        cube[248] = cube_tmp[3];
        cube[253] = cube_tmp[8];
        cube[254] = cube_tmp[9];
        cube[255] = cube_tmp[10];
        cube[260] = cube_tmp[15];
        cube[261] = cube_tmp[16];
        cube[262] = cube_tmp[17];
        cube[267] = cube_tmp[22];
        cube[268] = cube_tmp[23];
        cube[269] = cube_tmp[24];
        cube[274] = cube_tmp[29];
        cube[275] = cube_tmp[30];
        cube[276] = cube_tmp[31];
        cube[281] = cube_tmp[36];
        cube[282] = cube_tmp[37];
        cube[283] = cube_tmp[38];
        cube[288] = cube_tmp[43];
        cube[289] = cube_tmp[44];
        cube[290] = cube_tmp[45];
        break;

    case F:
        cube[43] = cube_tmp[98];
        cube[44] = cube_tmp[91];
        cube[45] = cube_tmp[84];
        cube[46] = cube_tmp[77];
        cube[47] = cube_tmp[70];
        cube[48] = cube_tmp[63];
        cube[49] = cube_tmp[56];
        cube[56] = cube_tmp[246];
        cube[63] = cube_tmp[247];
        cube[70] = cube_tmp[248];
        cube[77] = cube_tmp[249];
        cube[84] = cube_tmp[250];
        cube[91] = cube_tmp[251];
        cube[98] = cube_tmp[252];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[134];
        cube[101] = cube_tmp[127];
        cube[102] = cube_tmp[120];
        cube[103] = cube_tmp[113];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[99];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[135];
        cube[108] = cube_tmp[128];
        cube[109] = cube_tmp[121];
        cube[110] = cube_tmp[114];
        cube[111] = cube_tmp[107];
        cube[112] = cube_tmp[100];
        cube[113] = cube_tmp[143];
        cube[114] = cube_tmp[136];
        cube[115] = cube_tmp[129];
        cube[116] = cube_tmp[122];
        cube[117] = cube_tmp[115];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[101];
        cube[120] = cube_tmp[144];
        cube[121] = cube_tmp[137];
        cube[122] = cube_tmp[130];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[109];
        cube[126] = cube_tmp[102];
        cube[127] = cube_tmp[145];
        cube[128] = cube_tmp[138];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[117];
        cube[132] = cube_tmp[110];
        cube[133] = cube_tmp[103];
        cube[134] = cube_tmp[146];
        cube[135] = cube_tmp[139];
        cube[136] = cube_tmp[132];
        cube[137] = cube_tmp[125];
        cube[138] = cube_tmp[118];
        cube[139] = cube_tmp[111];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[147];
        cube[142] = cube_tmp[140];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[126];
        cube[145] = cube_tmp[119];
        cube[146] = cube_tmp[112];
        cube[147] = cube_tmp[105];
        cube[148] = cube_tmp[43];
        cube[155] = cube_tmp[44];
        cube[162] = cube_tmp[45];
        cube[169] = cube_tmp[46];
        cube[176] = cube_tmp[47];
        cube[183] = cube_tmp[48];
        cube[190] = cube_tmp[49];
        cube[246] = cube_tmp[190];
        cube[247] = cube_tmp[183];
        cube[248] = cube_tmp[176];
        cube[249] = cube_tmp[169];
        cube[250] = cube_tmp[162];
        cube[251] = cube_tmp[155];
        cube[252] = cube_tmp[148];
        break;

    case F_PRIME:
        cube[43] = cube_tmp[148];
        cube[44] = cube_tmp[155];
        cube[45] = cube_tmp[162];
        cube[46] = cube_tmp[169];
        cube[47] = cube_tmp[176];
        cube[48] = cube_tmp[183];
        cube[49] = cube_tmp[190];
        cube[56] = cube_tmp[49];
        cube[63] = cube_tmp[48];
        cube[70] = cube_tmp[47];
        cube[77] = cube_tmp[46];
        cube[84] = cube_tmp[45];
        cube[91] = cube_tmp[44];
        cube[98] = cube_tmp[43];
        cube[99] = cube_tmp[105];
        cube[100] = cube_tmp[112];
        cube[101] = cube_tmp[119];
        cube[102] = cube_tmp[126];
        cube[103] = cube_tmp[133];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[147];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[111];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[125];
        cube[110] = cube_tmp[132];
        cube[111] = cube_tmp[139];
        cube[112] = cube_tmp[146];
        cube[113] = cube_tmp[103];
        cube[114] = cube_tmp[110];
        cube[115] = cube_tmp[117];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[131];
        cube[118] = cube_tmp[138];
        cube[119] = cube_tmp[145];
        cube[120] = cube_tmp[102];
        cube[121] = cube_tmp[109];
        cube[122] = cube_tmp[116];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[137];
        cube[126] = cube_tmp[144];
        cube[127] = cube_tmp[101];
        cube[128] = cube_tmp[108];
        cube[129] = cube_tmp[115];
        cube[130] = cube_tmp[122];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[136];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[100];
        cube[135] = cube_tmp[107];
        cube[136] = cube_tmp[114];
        cube[137] = cube_tmp[121];
        cube[138] = cube_tmp[128];
        cube[139] = cube_tmp[135];
        cube[140] = cube_tmp[142];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[113];
        cube[144] = cube_tmp[120];
        cube[145] = cube_tmp[127];
        cube[146] = cube_tmp[134];
        cube[147] = cube_tmp[141];
        cube[148] = cube_tmp[252];
        cube[155] = cube_tmp[251];
        cube[162] = cube_tmp[250];
        cube[169] = cube_tmp[249];
        cube[176] = cube_tmp[248];
        cube[183] = cube_tmp[247];
        cube[190] = cube_tmp[246];
        cube[246] = cube_tmp[56];
        cube[247] = cube_tmp[63];
        cube[248] = cube_tmp[70];
        cube[249] = cube_tmp[77];
        cube[250] = cube_tmp[84];
        cube[251] = cube_tmp[91];
        cube[252] = cube_tmp[98];
        break;

    case F2:
        cube[43] = cube_tmp[252];
        cube[44] = cube_tmp[251];
        cube[45] = cube_tmp[250];
        cube[46] = cube_tmp[249];
        cube[47] = cube_tmp[248];
        cube[48] = cube_tmp[247];
        cube[49] = cube_tmp[246];
        cube[56] = cube_tmp[190];
        cube[63] = cube_tmp[183];
        cube[70] = cube_tmp[176];
        cube[77] = cube_tmp[169];
        cube[84] = cube_tmp[162];
        cube[91] = cube_tmp[155];
        cube[98] = cube_tmp[148];
        cube[99] = cube_tmp[147];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[145];
        cube[102] = cube_tmp[144];
        cube[103] = cube_tmp[143];
        cube[104] = cube_tmp[142];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[140];
        cube[107] = cube_tmp[139];
        cube[108] = cube_tmp[138];
        cube[109] = cube_tmp[137];
        cube[110] = cube_tmp[136];
        cube[111] = cube_tmp[135];
        cube[112] = cube_tmp[134];
        cube[113] = cube_tmp[133];
        cube[114] = cube_tmp[132];
        cube[115] = cube_tmp[131];
        cube[116] = cube_tmp[130];
        cube[117] = cube_tmp[129];
        cube[118] = cube_tmp[128];
        cube[119] = cube_tmp[127];
        cube[120] = cube_tmp[126];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[124];
        cube[124] = cube_tmp[122];
        cube[125] = cube_tmp[121];
        cube[126] = cube_tmp[120];
        cube[127] = cube_tmp[119];
        cube[128] = cube_tmp[118];
        cube[129] = cube_tmp[117];
        cube[130] = cube_tmp[116];
        cube[131] = cube_tmp[115];
        cube[132] = cube_tmp[114];
        cube[133] = cube_tmp[113];
        cube[134] = cube_tmp[112];
        cube[135] = cube_tmp[111];
        cube[136] = cube_tmp[110];
        cube[137] = cube_tmp[109];
        cube[138] = cube_tmp[108];
        cube[139] = cube_tmp[107];
        cube[140] = cube_tmp[106];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[104];
        cube[143] = cube_tmp[103];
        cube[144] = cube_tmp[102];
        cube[145] = cube_tmp[101];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[99];
        cube[148] = cube_tmp[98];
        cube[155] = cube_tmp[91];
        cube[162] = cube_tmp[84];
        cube[169] = cube_tmp[77];
        cube[176] = cube_tmp[70];
        cube[183] = cube_tmp[63];
        cube[190] = cube_tmp[56];
        cube[246] = cube_tmp[49];
        cube[247] = cube_tmp[48];
        cube[248] = cube_tmp[47];
        cube[249] = cube_tmp[46];
        cube[250] = cube_tmp[45];
        cube[251] = cube_tmp[44];
        cube[252] = cube_tmp[43];
        break;

    case Fw:
        cube[36] = cube_tmp[97];
        cube[37] = cube_tmp[90];
        cube[38] = cube_tmp[83];
        cube[39] = cube_tmp[76];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[62];
        cube[42] = cube_tmp[55];
        cube[43] = cube_tmp[98];
        cube[44] = cube_tmp[91];
        cube[45] = cube_tmp[84];
        cube[46] = cube_tmp[77];
        cube[47] = cube_tmp[70];
        cube[48] = cube_tmp[63];
        cube[49] = cube_tmp[56];
        cube[55] = cube_tmp[253];
        cube[56] = cube_tmp[246];
        cube[62] = cube_tmp[254];
        cube[63] = cube_tmp[247];
        cube[69] = cube_tmp[255];
        cube[70] = cube_tmp[248];
        cube[76] = cube_tmp[256];
        cube[77] = cube_tmp[249];
        cube[83] = cube_tmp[257];
        cube[84] = cube_tmp[250];
        cube[90] = cube_tmp[258];
        cube[91] = cube_tmp[251];
        cube[97] = cube_tmp[259];
        cube[98] = cube_tmp[252];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[134];
        cube[101] = cube_tmp[127];
        cube[102] = cube_tmp[120];
        cube[103] = cube_tmp[113];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[99];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[135];
        cube[108] = cube_tmp[128];
        cube[109] = cube_tmp[121];
        cube[110] = cube_tmp[114];
        cube[111] = cube_tmp[107];
        cube[112] = cube_tmp[100];
        cube[113] = cube_tmp[143];
        cube[114] = cube_tmp[136];
        cube[115] = cube_tmp[129];
        cube[116] = cube_tmp[122];
        cube[117] = cube_tmp[115];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[101];
        cube[120] = cube_tmp[144];
        cube[121] = cube_tmp[137];
        cube[122] = cube_tmp[130];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[109];
        cube[126] = cube_tmp[102];
        cube[127] = cube_tmp[145];
        cube[128] = cube_tmp[138];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[117];
        cube[132] = cube_tmp[110];
        cube[133] = cube_tmp[103];
        cube[134] = cube_tmp[146];
        cube[135] = cube_tmp[139];
        cube[136] = cube_tmp[132];
        cube[137] = cube_tmp[125];
        cube[138] = cube_tmp[118];
        cube[139] = cube_tmp[111];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[147];
        cube[142] = cube_tmp[140];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[126];
        cube[145] = cube_tmp[119];
        cube[146] = cube_tmp[112];
        cube[147] = cube_tmp[105];
        cube[148] = cube_tmp[43];
        cube[149] = cube_tmp[36];
        cube[155] = cube_tmp[44];
        cube[156] = cube_tmp[37];
        cube[162] = cube_tmp[45];
        cube[163] = cube_tmp[38];
        cube[169] = cube_tmp[46];
        cube[170] = cube_tmp[39];
        cube[176] = cube_tmp[47];
        cube[177] = cube_tmp[40];
        cube[183] = cube_tmp[48];
        cube[184] = cube_tmp[41];
        cube[190] = cube_tmp[49];
        cube[191] = cube_tmp[42];
        cube[246] = cube_tmp[190];
        cube[247] = cube_tmp[183];
        cube[248] = cube_tmp[176];
        cube[249] = cube_tmp[169];
        cube[250] = cube_tmp[162];
        cube[251] = cube_tmp[155];
        cube[252] = cube_tmp[148];
        cube[253] = cube_tmp[191];
        cube[254] = cube_tmp[184];
        cube[255] = cube_tmp[177];
        cube[256] = cube_tmp[170];
        cube[257] = cube_tmp[163];
        cube[258] = cube_tmp[156];
        cube[259] = cube_tmp[149];
        break;

    case Fw_PRIME:
        cube[36] = cube_tmp[149];
        cube[37] = cube_tmp[156];
        cube[38] = cube_tmp[163];
        cube[39] = cube_tmp[170];
        cube[40] = cube_tmp[177];
        cube[41] = cube_tmp[184];
        cube[42] = cube_tmp[191];
        cube[43] = cube_tmp[148];
        cube[44] = cube_tmp[155];
        cube[45] = cube_tmp[162];
        cube[46] = cube_tmp[169];
        cube[47] = cube_tmp[176];
        cube[48] = cube_tmp[183];
        cube[49] = cube_tmp[190];
        cube[55] = cube_tmp[42];
        cube[56] = cube_tmp[49];
        cube[62] = cube_tmp[41];
        cube[63] = cube_tmp[48];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[47];
        cube[76] = cube_tmp[39];
        cube[77] = cube_tmp[46];
        cube[83] = cube_tmp[38];
        cube[84] = cube_tmp[45];
        cube[90] = cube_tmp[37];
        cube[91] = cube_tmp[44];
        cube[97] = cube_tmp[36];
        cube[98] = cube_tmp[43];
        cube[99] = cube_tmp[105];
        cube[100] = cube_tmp[112];
        cube[101] = cube_tmp[119];
        cube[102] = cube_tmp[126];
        cube[103] = cube_tmp[133];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[147];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[111];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[125];
        cube[110] = cube_tmp[132];
        cube[111] = cube_tmp[139];
        cube[112] = cube_tmp[146];
        cube[113] = cube_tmp[103];
        cube[114] = cube_tmp[110];
        cube[115] = cube_tmp[117];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[131];
        cube[118] = cube_tmp[138];
        cube[119] = cube_tmp[145];
        cube[120] = cube_tmp[102];
        cube[121] = cube_tmp[109];
        cube[122] = cube_tmp[116];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[137];
        cube[126] = cube_tmp[144];
        cube[127] = cube_tmp[101];
        cube[128] = cube_tmp[108];
        cube[129] = cube_tmp[115];
        cube[130] = cube_tmp[122];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[136];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[100];
        cube[135] = cube_tmp[107];
        cube[136] = cube_tmp[114];
        cube[137] = cube_tmp[121];
        cube[138] = cube_tmp[128];
        cube[139] = cube_tmp[135];
        cube[140] = cube_tmp[142];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[113];
        cube[144] = cube_tmp[120];
        cube[145] = cube_tmp[127];
        cube[146] = cube_tmp[134];
        cube[147] = cube_tmp[141];
        cube[148] = cube_tmp[252];
        cube[149] = cube_tmp[259];
        cube[155] = cube_tmp[251];
        cube[156] = cube_tmp[258];
        cube[162] = cube_tmp[250];
        cube[163] = cube_tmp[257];
        cube[169] = cube_tmp[249];
        cube[170] = cube_tmp[256];
        cube[176] = cube_tmp[248];
        cube[177] = cube_tmp[255];
        cube[183] = cube_tmp[247];
        cube[184] = cube_tmp[254];
        cube[190] = cube_tmp[246];
        cube[191] = cube_tmp[253];
        cube[246] = cube_tmp[56];
        cube[247] = cube_tmp[63];
        cube[248] = cube_tmp[70];
        cube[249] = cube_tmp[77];
        cube[250] = cube_tmp[84];
        cube[251] = cube_tmp[91];
        cube[252] = cube_tmp[98];
        cube[253] = cube_tmp[55];
        cube[254] = cube_tmp[62];
        cube[255] = cube_tmp[69];
        cube[256] = cube_tmp[76];
        cube[257] = cube_tmp[83];
        cube[258] = cube_tmp[90];
        cube[259] = cube_tmp[97];
        break;

    case Fw2:
        cube[36] = cube_tmp[259];
        cube[37] = cube_tmp[258];
        cube[38] = cube_tmp[257];
        cube[39] = cube_tmp[256];
        cube[40] = cube_tmp[255];
        cube[41] = cube_tmp[254];
        cube[42] = cube_tmp[253];
        cube[43] = cube_tmp[252];
        cube[44] = cube_tmp[251];
        cube[45] = cube_tmp[250];
        cube[46] = cube_tmp[249];
        cube[47] = cube_tmp[248];
        cube[48] = cube_tmp[247];
        cube[49] = cube_tmp[246];
        cube[55] = cube_tmp[191];
        cube[56] = cube_tmp[190];
        cube[62] = cube_tmp[184];
        cube[63] = cube_tmp[183];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[176];
        cube[76] = cube_tmp[170];
        cube[77] = cube_tmp[169];
        cube[83] = cube_tmp[163];
        cube[84] = cube_tmp[162];
        cube[90] = cube_tmp[156];
        cube[91] = cube_tmp[155];
        cube[97] = cube_tmp[149];
        cube[98] = cube_tmp[148];
        cube[99] = cube_tmp[147];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[145];
        cube[102] = cube_tmp[144];
        cube[103] = cube_tmp[143];
        cube[104] = cube_tmp[142];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[140];
        cube[107] = cube_tmp[139];
        cube[108] = cube_tmp[138];
        cube[109] = cube_tmp[137];
        cube[110] = cube_tmp[136];
        cube[111] = cube_tmp[135];
        cube[112] = cube_tmp[134];
        cube[113] = cube_tmp[133];
        cube[114] = cube_tmp[132];
        cube[115] = cube_tmp[131];
        cube[116] = cube_tmp[130];
        cube[117] = cube_tmp[129];
        cube[118] = cube_tmp[128];
        cube[119] = cube_tmp[127];
        cube[120] = cube_tmp[126];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[124];
        cube[124] = cube_tmp[122];
        cube[125] = cube_tmp[121];
        cube[126] = cube_tmp[120];
        cube[127] = cube_tmp[119];
        cube[128] = cube_tmp[118];
        cube[129] = cube_tmp[117];
        cube[130] = cube_tmp[116];
        cube[131] = cube_tmp[115];
        cube[132] = cube_tmp[114];
        cube[133] = cube_tmp[113];
        cube[134] = cube_tmp[112];
        cube[135] = cube_tmp[111];
        cube[136] = cube_tmp[110];
        cube[137] = cube_tmp[109];
        cube[138] = cube_tmp[108];
        cube[139] = cube_tmp[107];
        cube[140] = cube_tmp[106];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[104];
        cube[143] = cube_tmp[103];
        cube[144] = cube_tmp[102];
        cube[145] = cube_tmp[101];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[99];
        cube[148] = cube_tmp[98];
        cube[149] = cube_tmp[97];
        cube[155] = cube_tmp[91];
        cube[156] = cube_tmp[90];
        cube[162] = cube_tmp[84];
        cube[163] = cube_tmp[83];
        cube[169] = cube_tmp[77];
        cube[170] = cube_tmp[76];
        cube[176] = cube_tmp[70];
        cube[177] = cube_tmp[69];
        cube[183] = cube_tmp[63];
        cube[184] = cube_tmp[62];
        cube[190] = cube_tmp[56];
        cube[191] = cube_tmp[55];
        cube[246] = cube_tmp[49];
        cube[247] = cube_tmp[48];
        cube[248] = cube_tmp[47];
        cube[249] = cube_tmp[46];
        cube[250] = cube_tmp[45];
        cube[251] = cube_tmp[44];
        cube[252] = cube_tmp[43];
        cube[253] = cube_tmp[42];
        cube[254] = cube_tmp[41];
        cube[255] = cube_tmp[40];
        cube[256] = cube_tmp[39];
        cube[257] = cube_tmp[38];
        cube[258] = cube_tmp[37];
        cube[259] = cube_tmp[36];
        break;

    case threeFw:
        cube[29] = cube_tmp[96];
        cube[30] = cube_tmp[89];
        cube[31] = cube_tmp[82];
        cube[32] = cube_tmp[75];
        cube[33] = cube_tmp[68];
        cube[34] = cube_tmp[61];
        cube[35] = cube_tmp[54];
        cube[36] = cube_tmp[97];
        cube[37] = cube_tmp[90];
        cube[38] = cube_tmp[83];
        cube[39] = cube_tmp[76];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[62];
        cube[42] = cube_tmp[55];
        cube[43] = cube_tmp[98];
        cube[44] = cube_tmp[91];
        cube[45] = cube_tmp[84];
        cube[46] = cube_tmp[77];
        cube[47] = cube_tmp[70];
        cube[48] = cube_tmp[63];
        cube[49] = cube_tmp[56];
        cube[54] = cube_tmp[260];
        cube[55] = cube_tmp[253];
        cube[56] = cube_tmp[246];
        cube[61] = cube_tmp[261];
        cube[62] = cube_tmp[254];
        cube[63] = cube_tmp[247];
        cube[68] = cube_tmp[262];
        cube[69] = cube_tmp[255];
        cube[70] = cube_tmp[248];
        cube[75] = cube_tmp[263];
        cube[76] = cube_tmp[256];
        cube[77] = cube_tmp[249];
        cube[82] = cube_tmp[264];
        cube[83] = cube_tmp[257];
        cube[84] = cube_tmp[250];
        cube[89] = cube_tmp[265];
        cube[90] = cube_tmp[258];
        cube[91] = cube_tmp[251];
        cube[96] = cube_tmp[266];
        cube[97] = cube_tmp[259];
        cube[98] = cube_tmp[252];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[134];
        cube[101] = cube_tmp[127];
        cube[102] = cube_tmp[120];
        cube[103] = cube_tmp[113];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[99];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[135];
        cube[108] = cube_tmp[128];
        cube[109] = cube_tmp[121];
        cube[110] = cube_tmp[114];
        cube[111] = cube_tmp[107];
        cube[112] = cube_tmp[100];
        cube[113] = cube_tmp[143];
        cube[114] = cube_tmp[136];
        cube[115] = cube_tmp[129];
        cube[116] = cube_tmp[122];
        cube[117] = cube_tmp[115];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[101];
        cube[120] = cube_tmp[144];
        cube[121] = cube_tmp[137];
        cube[122] = cube_tmp[130];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[109];
        cube[126] = cube_tmp[102];
        cube[127] = cube_tmp[145];
        cube[128] = cube_tmp[138];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[117];
        cube[132] = cube_tmp[110];
        cube[133] = cube_tmp[103];
        cube[134] = cube_tmp[146];
        cube[135] = cube_tmp[139];
        cube[136] = cube_tmp[132];
        cube[137] = cube_tmp[125];
        cube[138] = cube_tmp[118];
        cube[139] = cube_tmp[111];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[147];
        cube[142] = cube_tmp[140];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[126];
        cube[145] = cube_tmp[119];
        cube[146] = cube_tmp[112];
        cube[147] = cube_tmp[105];
        cube[148] = cube_tmp[43];
        cube[149] = cube_tmp[36];
        cube[150] = cube_tmp[29];
        cube[155] = cube_tmp[44];
        cube[156] = cube_tmp[37];
        cube[157] = cube_tmp[30];
        cube[162] = cube_tmp[45];
        cube[163] = cube_tmp[38];
        cube[164] = cube_tmp[31];
        cube[169] = cube_tmp[46];
        cube[170] = cube_tmp[39];
        cube[171] = cube_tmp[32];
        cube[176] = cube_tmp[47];
        cube[177] = cube_tmp[40];
        cube[178] = cube_tmp[33];
        cube[183] = cube_tmp[48];
        cube[184] = cube_tmp[41];
        cube[185] = cube_tmp[34];
        cube[190] = cube_tmp[49];
        cube[191] = cube_tmp[42];
        cube[192] = cube_tmp[35];
        cube[246] = cube_tmp[190];
        cube[247] = cube_tmp[183];
        cube[248] = cube_tmp[176];
        cube[249] = cube_tmp[169];
        cube[250] = cube_tmp[162];
        cube[251] = cube_tmp[155];
        cube[252] = cube_tmp[148];
        cube[253] = cube_tmp[191];
        cube[254] = cube_tmp[184];
        cube[255] = cube_tmp[177];
        cube[256] = cube_tmp[170];
        cube[257] = cube_tmp[163];
        cube[258] = cube_tmp[156];
        cube[259] = cube_tmp[149];
        cube[260] = cube_tmp[192];
        cube[261] = cube_tmp[185];
        cube[262] = cube_tmp[178];
        cube[263] = cube_tmp[171];
        cube[264] = cube_tmp[164];
        cube[265] = cube_tmp[157];
        cube[266] = cube_tmp[150];
        break;

    case threeFw_PRIME:
        cube[29] = cube_tmp[150];
        cube[30] = cube_tmp[157];
        cube[31] = cube_tmp[164];
        cube[32] = cube_tmp[171];
        cube[33] = cube_tmp[178];
        cube[34] = cube_tmp[185];
        cube[35] = cube_tmp[192];
        cube[36] = cube_tmp[149];
        cube[37] = cube_tmp[156];
        cube[38] = cube_tmp[163];
        cube[39] = cube_tmp[170];
        cube[40] = cube_tmp[177];
        cube[41] = cube_tmp[184];
        cube[42] = cube_tmp[191];
        cube[43] = cube_tmp[148];
        cube[44] = cube_tmp[155];
        cube[45] = cube_tmp[162];
        cube[46] = cube_tmp[169];
        cube[47] = cube_tmp[176];
        cube[48] = cube_tmp[183];
        cube[49] = cube_tmp[190];
        cube[54] = cube_tmp[35];
        cube[55] = cube_tmp[42];
        cube[56] = cube_tmp[49];
        cube[61] = cube_tmp[34];
        cube[62] = cube_tmp[41];
        cube[63] = cube_tmp[48];
        cube[68] = cube_tmp[33];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[47];
        cube[75] = cube_tmp[32];
        cube[76] = cube_tmp[39];
        cube[77] = cube_tmp[46];
        cube[82] = cube_tmp[31];
        cube[83] = cube_tmp[38];
        cube[84] = cube_tmp[45];
        cube[89] = cube_tmp[30];
        cube[90] = cube_tmp[37];
        cube[91] = cube_tmp[44];
        cube[96] = cube_tmp[29];
        cube[97] = cube_tmp[36];
        cube[98] = cube_tmp[43];
        cube[99] = cube_tmp[105];
        cube[100] = cube_tmp[112];
        cube[101] = cube_tmp[119];
        cube[102] = cube_tmp[126];
        cube[103] = cube_tmp[133];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[147];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[111];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[125];
        cube[110] = cube_tmp[132];
        cube[111] = cube_tmp[139];
        cube[112] = cube_tmp[146];
        cube[113] = cube_tmp[103];
        cube[114] = cube_tmp[110];
        cube[115] = cube_tmp[117];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[131];
        cube[118] = cube_tmp[138];
        cube[119] = cube_tmp[145];
        cube[120] = cube_tmp[102];
        cube[121] = cube_tmp[109];
        cube[122] = cube_tmp[116];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[137];
        cube[126] = cube_tmp[144];
        cube[127] = cube_tmp[101];
        cube[128] = cube_tmp[108];
        cube[129] = cube_tmp[115];
        cube[130] = cube_tmp[122];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[136];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[100];
        cube[135] = cube_tmp[107];
        cube[136] = cube_tmp[114];
        cube[137] = cube_tmp[121];
        cube[138] = cube_tmp[128];
        cube[139] = cube_tmp[135];
        cube[140] = cube_tmp[142];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[113];
        cube[144] = cube_tmp[120];
        cube[145] = cube_tmp[127];
        cube[146] = cube_tmp[134];
        cube[147] = cube_tmp[141];
        cube[148] = cube_tmp[252];
        cube[149] = cube_tmp[259];
        cube[150] = cube_tmp[266];
        cube[155] = cube_tmp[251];
        cube[156] = cube_tmp[258];
        cube[157] = cube_tmp[265];
        cube[162] = cube_tmp[250];
        cube[163] = cube_tmp[257];
        cube[164] = cube_tmp[264];
        cube[169] = cube_tmp[249];
        cube[170] = cube_tmp[256];
        cube[171] = cube_tmp[263];
        cube[176] = cube_tmp[248];
        cube[177] = cube_tmp[255];
        cube[178] = cube_tmp[262];
        cube[183] = cube_tmp[247];
        cube[184] = cube_tmp[254];
        cube[185] = cube_tmp[261];
        cube[190] = cube_tmp[246];
        cube[191] = cube_tmp[253];
        cube[192] = cube_tmp[260];
        cube[246] = cube_tmp[56];
        cube[247] = cube_tmp[63];
        cube[248] = cube_tmp[70];
        cube[249] = cube_tmp[77];
        cube[250] = cube_tmp[84];
        cube[251] = cube_tmp[91];
        cube[252] = cube_tmp[98];
        cube[253] = cube_tmp[55];
        cube[254] = cube_tmp[62];
        cube[255] = cube_tmp[69];
        cube[256] = cube_tmp[76];
        cube[257] = cube_tmp[83];
        cube[258] = cube_tmp[90];
        cube[259] = cube_tmp[97];
        cube[260] = cube_tmp[54];
        cube[261] = cube_tmp[61];
        cube[262] = cube_tmp[68];
        cube[263] = cube_tmp[75];
        cube[264] = cube_tmp[82];
        cube[265] = cube_tmp[89];
        cube[266] = cube_tmp[96];
        break;

    case threeFw2:
        cube[29] = cube_tmp[266];
        cube[30] = cube_tmp[265];
        cube[31] = cube_tmp[264];
        cube[32] = cube_tmp[263];
        cube[33] = cube_tmp[262];
        cube[34] = cube_tmp[261];
        cube[35] = cube_tmp[260];
        cube[36] = cube_tmp[259];
        cube[37] = cube_tmp[258];
        cube[38] = cube_tmp[257];
        cube[39] = cube_tmp[256];
        cube[40] = cube_tmp[255];
        cube[41] = cube_tmp[254];
        cube[42] = cube_tmp[253];
        cube[43] = cube_tmp[252];
        cube[44] = cube_tmp[251];
        cube[45] = cube_tmp[250];
        cube[46] = cube_tmp[249];
        cube[47] = cube_tmp[248];
        cube[48] = cube_tmp[247];
        cube[49] = cube_tmp[246];
        cube[54] = cube_tmp[192];
        cube[55] = cube_tmp[191];
        cube[56] = cube_tmp[190];
        cube[61] = cube_tmp[185];
        cube[62] = cube_tmp[184];
        cube[63] = cube_tmp[183];
        cube[68] = cube_tmp[178];
        cube[69] = cube_tmp[177];
        cube[70] = cube_tmp[176];
        cube[75] = cube_tmp[171];
        cube[76] = cube_tmp[170];
        cube[77] = cube_tmp[169];
        cube[82] = cube_tmp[164];
        cube[83] = cube_tmp[163];
        cube[84] = cube_tmp[162];
        cube[89] = cube_tmp[157];
        cube[90] = cube_tmp[156];
        cube[91] = cube_tmp[155];
        cube[96] = cube_tmp[150];
        cube[97] = cube_tmp[149];
        cube[98] = cube_tmp[148];
        cube[99] = cube_tmp[147];
        cube[100] = cube_tmp[146];
        cube[101] = cube_tmp[145];
        cube[102] = cube_tmp[144];
        cube[103] = cube_tmp[143];
        cube[104] = cube_tmp[142];
        cube[105] = cube_tmp[141];
        cube[106] = cube_tmp[140];
        cube[107] = cube_tmp[139];
        cube[108] = cube_tmp[138];
        cube[109] = cube_tmp[137];
        cube[110] = cube_tmp[136];
        cube[111] = cube_tmp[135];
        cube[112] = cube_tmp[134];
        cube[113] = cube_tmp[133];
        cube[114] = cube_tmp[132];
        cube[115] = cube_tmp[131];
        cube[116] = cube_tmp[130];
        cube[117] = cube_tmp[129];
        cube[118] = cube_tmp[128];
        cube[119] = cube_tmp[127];
        cube[120] = cube_tmp[126];
        cube[121] = cube_tmp[125];
        cube[122] = cube_tmp[124];
        cube[124] = cube_tmp[122];
        cube[125] = cube_tmp[121];
        cube[126] = cube_tmp[120];
        cube[127] = cube_tmp[119];
        cube[128] = cube_tmp[118];
        cube[129] = cube_tmp[117];
        cube[130] = cube_tmp[116];
        cube[131] = cube_tmp[115];
        cube[132] = cube_tmp[114];
        cube[133] = cube_tmp[113];
        cube[134] = cube_tmp[112];
        cube[135] = cube_tmp[111];
        cube[136] = cube_tmp[110];
        cube[137] = cube_tmp[109];
        cube[138] = cube_tmp[108];
        cube[139] = cube_tmp[107];
        cube[140] = cube_tmp[106];
        cube[141] = cube_tmp[105];
        cube[142] = cube_tmp[104];
        cube[143] = cube_tmp[103];
        cube[144] = cube_tmp[102];
        cube[145] = cube_tmp[101];
        cube[146] = cube_tmp[100];
        cube[147] = cube_tmp[99];
        cube[148] = cube_tmp[98];
        cube[149] = cube_tmp[97];
        cube[150] = cube_tmp[96];
        cube[155] = cube_tmp[91];
        cube[156] = cube_tmp[90];
        cube[157] = cube_tmp[89];
        cube[162] = cube_tmp[84];
        cube[163] = cube_tmp[83];
        cube[164] = cube_tmp[82];
        cube[169] = cube_tmp[77];
        cube[170] = cube_tmp[76];
        cube[171] = cube_tmp[75];
        cube[176] = cube_tmp[70];
        cube[177] = cube_tmp[69];
        cube[178] = cube_tmp[68];
        cube[183] = cube_tmp[63];
        cube[184] = cube_tmp[62];
        cube[185] = cube_tmp[61];
        cube[190] = cube_tmp[56];
        cube[191] = cube_tmp[55];
        cube[192] = cube_tmp[54];
        cube[246] = cube_tmp[49];
        cube[247] = cube_tmp[48];
        cube[248] = cube_tmp[47];
        cube[249] = cube_tmp[46];
        cube[250] = cube_tmp[45];
        cube[251] = cube_tmp[44];
        cube[252] = cube_tmp[43];
        cube[253] = cube_tmp[42];
        cube[254] = cube_tmp[41];
        cube[255] = cube_tmp[40];
        cube[256] = cube_tmp[39];
        cube[257] = cube_tmp[38];
        cube[258] = cube_tmp[37];
        cube[259] = cube_tmp[36];
        cube[260] = cube_tmp[35];
        cube[261] = cube_tmp[34];
        cube[262] = cube_tmp[33];
        cube[263] = cube_tmp[32];
        cube[264] = cube_tmp[31];
        cube[265] = cube_tmp[30];
        cube[266] = cube_tmp[29];
        break;

    case R:
        cube[7] = cube_tmp[105];
        cube[14] = cube_tmp[112];
        cube[21] = cube_tmp[119];
        cube[28] = cube_tmp[126];
        cube[35] = cube_tmp[133];
        cube[42] = cube_tmp[140];
        cube[49] = cube_tmp[147];
        cube[105] = cube_tmp[252];
        cube[112] = cube_tmp[259];
        cube[119] = cube_tmp[266];
        cube[126] = cube_tmp[273];
        cube[133] = cube_tmp[280];
        cube[140] = cube_tmp[287];
        cube[147] = cube_tmp[294];
        cube[148] = cube_tmp[190];
        cube[149] = cube_tmp[183];
        cube[150] = cube_tmp[176];
        cube[151] = cube_tmp[169];
        cube[152] = cube_tmp[162];
        cube[153] = cube_tmp[155];
        cube[154] = cube_tmp[148];
        cube[155] = cube_tmp[191];
        cube[156] = cube_tmp[184];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[170];
        cube[159] = cube_tmp[163];
        cube[160] = cube_tmp[156];
        cube[161] = cube_tmp[149];
        cube[162] = cube_tmp[192];
        cube[163] = cube_tmp[185];
        cube[164] = cube_tmp[178];
        cube[165] = cube_tmp[171];
        cube[166] = cube_tmp[164];
        cube[167] = cube_tmp[157];
        cube[168] = cube_tmp[150];
        cube[169] = cube_tmp[193];
        cube[170] = cube_tmp[186];
        cube[171] = cube_tmp[179];
        cube[173] = cube_tmp[165];
        cube[174] = cube_tmp[158];
        cube[175] = cube_tmp[151];
        cube[176] = cube_tmp[194];
        cube[177] = cube_tmp[187];
        cube[178] = cube_tmp[180];
        cube[179] = cube_tmp[173];
        cube[180] = cube_tmp[166];
        cube[181] = cube_tmp[159];
        cube[182] = cube_tmp[152];
        cube[183] = cube_tmp[195];
        cube[184] = cube_tmp[188];
        cube[185] = cube_tmp[181];
        cube[186] = cube_tmp[174];
        cube[187] = cube_tmp[167];
        cube[188] = cube_tmp[160];
        cube[189] = cube_tmp[153];
        cube[190] = cube_tmp[196];
        cube[191] = cube_tmp[189];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[175];
        cube[194] = cube_tmp[168];
        cube[195] = cube_tmp[161];
        cube[196] = cube_tmp[154];
        cube[197] = cube_tmp[49];
        cube[204] = cube_tmp[42];
        cube[211] = cube_tmp[35];
        cube[218] = cube_tmp[28];
        cube[225] = cube_tmp[21];
        cube[232] = cube_tmp[14];
        cube[239] = cube_tmp[7];
        cube[252] = cube_tmp[239];
        cube[259] = cube_tmp[232];
        cube[266] = cube_tmp[225];
        cube[273] = cube_tmp[218];
        cube[280] = cube_tmp[211];
        cube[287] = cube_tmp[204];
        cube[294] = cube_tmp[197];
        break;

    case R_PRIME:
        cube[7] = cube_tmp[239];
        cube[14] = cube_tmp[232];
        cube[21] = cube_tmp[225];
        cube[28] = cube_tmp[218];
        cube[35] = cube_tmp[211];
        cube[42] = cube_tmp[204];
        cube[49] = cube_tmp[197];
        cube[105] = cube_tmp[7];
        cube[112] = cube_tmp[14];
        cube[119] = cube_tmp[21];
        cube[126] = cube_tmp[28];
        cube[133] = cube_tmp[35];
        cube[140] = cube_tmp[42];
        cube[147] = cube_tmp[49];
        cube[148] = cube_tmp[154];
        cube[149] = cube_tmp[161];
        cube[150] = cube_tmp[168];
        cube[151] = cube_tmp[175];
        cube[152] = cube_tmp[182];
        cube[153] = cube_tmp[189];
        cube[154] = cube_tmp[196];
        cube[155] = cube_tmp[153];
        cube[156] = cube_tmp[160];
        cube[157] = cube_tmp[167];
        cube[158] = cube_tmp[174];
        cube[159] = cube_tmp[181];
        cube[160] = cube_tmp[188];
        cube[161] = cube_tmp[195];
        cube[162] = cube_tmp[152];
        cube[163] = cube_tmp[159];
        cube[164] = cube_tmp[166];
        cube[165] = cube_tmp[173];
        cube[166] = cube_tmp[180];
        cube[167] = cube_tmp[187];
        cube[168] = cube_tmp[194];
        cube[169] = cube_tmp[151];
        cube[170] = cube_tmp[158];
        cube[171] = cube_tmp[165];
        cube[173] = cube_tmp[179];
        cube[174] = cube_tmp[186];
        cube[175] = cube_tmp[193];
        cube[176] = cube_tmp[150];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[164];
        cube[179] = cube_tmp[171];
        cube[180] = cube_tmp[178];
        cube[181] = cube_tmp[185];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[149];
        cube[184] = cube_tmp[156];
        cube[185] = cube_tmp[163];
        cube[186] = cube_tmp[170];
        cube[187] = cube_tmp[177];
        cube[188] = cube_tmp[184];
        cube[189] = cube_tmp[191];
        cube[190] = cube_tmp[148];
        cube[191] = cube_tmp[155];
        cube[192] = cube_tmp[162];
        cube[193] = cube_tmp[169];
        cube[194] = cube_tmp[176];
        cube[195] = cube_tmp[183];
        cube[196] = cube_tmp[190];
        cube[197] = cube_tmp[294];
        cube[204] = cube_tmp[287];
        cube[211] = cube_tmp[280];
        cube[218] = cube_tmp[273];
        cube[225] = cube_tmp[266];
        cube[232] = cube_tmp[259];
        cube[239] = cube_tmp[252];
        cube[252] = cube_tmp[105];
        cube[259] = cube_tmp[112];
        cube[266] = cube_tmp[119];
        cube[273] = cube_tmp[126];
        cube[280] = cube_tmp[133];
        cube[287] = cube_tmp[140];
        cube[294] = cube_tmp[147];
        break;

    case R2:
        cube[7] = cube_tmp[252];
        cube[14] = cube_tmp[259];
        cube[21] = cube_tmp[266];
        cube[28] = cube_tmp[273];
        cube[35] = cube_tmp[280];
        cube[42] = cube_tmp[287];
        cube[49] = cube_tmp[294];
        cube[105] = cube_tmp[239];
        cube[112] = cube_tmp[232];
        cube[119] = cube_tmp[225];
        cube[126] = cube_tmp[218];
        cube[133] = cube_tmp[211];
        cube[140] = cube_tmp[204];
        cube[147] = cube_tmp[197];
        cube[148] = cube_tmp[196];
        cube[149] = cube_tmp[195];
        cube[150] = cube_tmp[194];
        cube[151] = cube_tmp[193];
        cube[152] = cube_tmp[192];
        cube[153] = cube_tmp[191];
        cube[154] = cube_tmp[190];
        cube[155] = cube_tmp[189];
        cube[156] = cube_tmp[188];
        cube[157] = cube_tmp[187];
        cube[158] = cube_tmp[186];
        cube[159] = cube_tmp[185];
        cube[160] = cube_tmp[184];
        cube[161] = cube_tmp[183];
        cube[162] = cube_tmp[182];
        cube[163] = cube_tmp[181];
        cube[164] = cube_tmp[180];
        cube[165] = cube_tmp[179];
        cube[166] = cube_tmp[178];
        cube[167] = cube_tmp[177];
        cube[168] = cube_tmp[176];
        cube[169] = cube_tmp[175];
        cube[170] = cube_tmp[174];
        cube[171] = cube_tmp[173];
        cube[173] = cube_tmp[171];
        cube[174] = cube_tmp[170];
        cube[175] = cube_tmp[169];
        cube[176] = cube_tmp[168];
        cube[177] = cube_tmp[167];
        cube[178] = cube_tmp[166];
        cube[179] = cube_tmp[165];
        cube[180] = cube_tmp[164];
        cube[181] = cube_tmp[163];
        cube[182] = cube_tmp[162];
        cube[183] = cube_tmp[161];
        cube[184] = cube_tmp[160];
        cube[185] = cube_tmp[159];
        cube[186] = cube_tmp[158];
        cube[187] = cube_tmp[157];
        cube[188] = cube_tmp[156];
        cube[189] = cube_tmp[155];
        cube[190] = cube_tmp[154];
        cube[191] = cube_tmp[153];
        cube[192] = cube_tmp[152];
        cube[193] = cube_tmp[151];
        cube[194] = cube_tmp[150];
        cube[195] = cube_tmp[149];
        cube[196] = cube_tmp[148];
        cube[197] = cube_tmp[147];
        cube[204] = cube_tmp[140];
        cube[211] = cube_tmp[133];
        cube[218] = cube_tmp[126];
        cube[225] = cube_tmp[119];
        cube[232] = cube_tmp[112];
        cube[239] = cube_tmp[105];
        cube[252] = cube_tmp[7];
        cube[259] = cube_tmp[14];
        cube[266] = cube_tmp[21];
        cube[273] = cube_tmp[28];
        cube[280] = cube_tmp[35];
        cube[287] = cube_tmp[42];
        cube[294] = cube_tmp[49];
        break;

    case Rw:
        cube[6] = cube_tmp[104];
        cube[7] = cube_tmp[105];
        cube[13] = cube_tmp[111];
        cube[14] = cube_tmp[112];
        cube[20] = cube_tmp[118];
        cube[21] = cube_tmp[119];
        cube[27] = cube_tmp[125];
        cube[28] = cube_tmp[126];
        cube[34] = cube_tmp[132];
        cube[35] = cube_tmp[133];
        cube[41] = cube_tmp[139];
        cube[42] = cube_tmp[140];
        cube[48] = cube_tmp[146];
        cube[49] = cube_tmp[147];
        cube[104] = cube_tmp[251];
        cube[105] = cube_tmp[252];
        cube[111] = cube_tmp[258];
        cube[112] = cube_tmp[259];
        cube[118] = cube_tmp[265];
        cube[119] = cube_tmp[266];
        cube[125] = cube_tmp[272];
        cube[126] = cube_tmp[273];
        cube[132] = cube_tmp[279];
        cube[133] = cube_tmp[280];
        cube[139] = cube_tmp[286];
        cube[140] = cube_tmp[287];
        cube[146] = cube_tmp[293];
        cube[147] = cube_tmp[294];
        cube[148] = cube_tmp[190];
        cube[149] = cube_tmp[183];
        cube[150] = cube_tmp[176];
        cube[151] = cube_tmp[169];
        cube[152] = cube_tmp[162];
        cube[153] = cube_tmp[155];
        cube[154] = cube_tmp[148];
        cube[155] = cube_tmp[191];
        cube[156] = cube_tmp[184];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[170];
        cube[159] = cube_tmp[163];
        cube[160] = cube_tmp[156];
        cube[161] = cube_tmp[149];
        cube[162] = cube_tmp[192];
        cube[163] = cube_tmp[185];
        cube[164] = cube_tmp[178];
        cube[165] = cube_tmp[171];
        cube[166] = cube_tmp[164];
        cube[167] = cube_tmp[157];
        cube[168] = cube_tmp[150];
        cube[169] = cube_tmp[193];
        cube[170] = cube_tmp[186];
        cube[171] = cube_tmp[179];
        cube[173] = cube_tmp[165];
        cube[174] = cube_tmp[158];
        cube[175] = cube_tmp[151];
        cube[176] = cube_tmp[194];
        cube[177] = cube_tmp[187];
        cube[178] = cube_tmp[180];
        cube[179] = cube_tmp[173];
        cube[180] = cube_tmp[166];
        cube[181] = cube_tmp[159];
        cube[182] = cube_tmp[152];
        cube[183] = cube_tmp[195];
        cube[184] = cube_tmp[188];
        cube[185] = cube_tmp[181];
        cube[186] = cube_tmp[174];
        cube[187] = cube_tmp[167];
        cube[188] = cube_tmp[160];
        cube[189] = cube_tmp[153];
        cube[190] = cube_tmp[196];
        cube[191] = cube_tmp[189];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[175];
        cube[194] = cube_tmp[168];
        cube[195] = cube_tmp[161];
        cube[196] = cube_tmp[154];
        cube[197] = cube_tmp[49];
        cube[198] = cube_tmp[48];
        cube[204] = cube_tmp[42];
        cube[205] = cube_tmp[41];
        cube[211] = cube_tmp[35];
        cube[212] = cube_tmp[34];
        cube[218] = cube_tmp[28];
        cube[219] = cube_tmp[27];
        cube[225] = cube_tmp[21];
        cube[226] = cube_tmp[20];
        cube[232] = cube_tmp[14];
        cube[233] = cube_tmp[13];
        cube[239] = cube_tmp[7];
        cube[240] = cube_tmp[6];
        cube[251] = cube_tmp[240];
        cube[252] = cube_tmp[239];
        cube[258] = cube_tmp[233];
        cube[259] = cube_tmp[232];
        cube[265] = cube_tmp[226];
        cube[266] = cube_tmp[225];
        cube[272] = cube_tmp[219];
        cube[273] = cube_tmp[218];
        cube[279] = cube_tmp[212];
        cube[280] = cube_tmp[211];
        cube[286] = cube_tmp[205];
        cube[287] = cube_tmp[204];
        cube[293] = cube_tmp[198];
        cube[294] = cube_tmp[197];
        break;

    case Rw_PRIME:
        cube[6] = cube_tmp[240];
        cube[7] = cube_tmp[239];
        cube[13] = cube_tmp[233];
        cube[14] = cube_tmp[232];
        cube[20] = cube_tmp[226];
        cube[21] = cube_tmp[225];
        cube[27] = cube_tmp[219];
        cube[28] = cube_tmp[218];
        cube[34] = cube_tmp[212];
        cube[35] = cube_tmp[211];
        cube[41] = cube_tmp[205];
        cube[42] = cube_tmp[204];
        cube[48] = cube_tmp[198];
        cube[49] = cube_tmp[197];
        cube[104] = cube_tmp[6];
        cube[105] = cube_tmp[7];
        cube[111] = cube_tmp[13];
        cube[112] = cube_tmp[14];
        cube[118] = cube_tmp[20];
        cube[119] = cube_tmp[21];
        cube[125] = cube_tmp[27];
        cube[126] = cube_tmp[28];
        cube[132] = cube_tmp[34];
        cube[133] = cube_tmp[35];
        cube[139] = cube_tmp[41];
        cube[140] = cube_tmp[42];
        cube[146] = cube_tmp[48];
        cube[147] = cube_tmp[49];
        cube[148] = cube_tmp[154];
        cube[149] = cube_tmp[161];
        cube[150] = cube_tmp[168];
        cube[151] = cube_tmp[175];
        cube[152] = cube_tmp[182];
        cube[153] = cube_tmp[189];
        cube[154] = cube_tmp[196];
        cube[155] = cube_tmp[153];
        cube[156] = cube_tmp[160];
        cube[157] = cube_tmp[167];
        cube[158] = cube_tmp[174];
        cube[159] = cube_tmp[181];
        cube[160] = cube_tmp[188];
        cube[161] = cube_tmp[195];
        cube[162] = cube_tmp[152];
        cube[163] = cube_tmp[159];
        cube[164] = cube_tmp[166];
        cube[165] = cube_tmp[173];
        cube[166] = cube_tmp[180];
        cube[167] = cube_tmp[187];
        cube[168] = cube_tmp[194];
        cube[169] = cube_tmp[151];
        cube[170] = cube_tmp[158];
        cube[171] = cube_tmp[165];
        cube[173] = cube_tmp[179];
        cube[174] = cube_tmp[186];
        cube[175] = cube_tmp[193];
        cube[176] = cube_tmp[150];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[164];
        cube[179] = cube_tmp[171];
        cube[180] = cube_tmp[178];
        cube[181] = cube_tmp[185];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[149];
        cube[184] = cube_tmp[156];
        cube[185] = cube_tmp[163];
        cube[186] = cube_tmp[170];
        cube[187] = cube_tmp[177];
        cube[188] = cube_tmp[184];
        cube[189] = cube_tmp[191];
        cube[190] = cube_tmp[148];
        cube[191] = cube_tmp[155];
        cube[192] = cube_tmp[162];
        cube[193] = cube_tmp[169];
        cube[194] = cube_tmp[176];
        cube[195] = cube_tmp[183];
        cube[196] = cube_tmp[190];
        cube[197] = cube_tmp[294];
        cube[198] = cube_tmp[293];
        cube[204] = cube_tmp[287];
        cube[205] = cube_tmp[286];
        cube[211] = cube_tmp[280];
        cube[212] = cube_tmp[279];
        cube[218] = cube_tmp[273];
        cube[219] = cube_tmp[272];
        cube[225] = cube_tmp[266];
        cube[226] = cube_tmp[265];
        cube[232] = cube_tmp[259];
        cube[233] = cube_tmp[258];
        cube[239] = cube_tmp[252];
        cube[240] = cube_tmp[251];
        cube[251] = cube_tmp[104];
        cube[252] = cube_tmp[105];
        cube[258] = cube_tmp[111];
        cube[259] = cube_tmp[112];
        cube[265] = cube_tmp[118];
        cube[266] = cube_tmp[119];
        cube[272] = cube_tmp[125];
        cube[273] = cube_tmp[126];
        cube[279] = cube_tmp[132];
        cube[280] = cube_tmp[133];
        cube[286] = cube_tmp[139];
        cube[287] = cube_tmp[140];
        cube[293] = cube_tmp[146];
        cube[294] = cube_tmp[147];
        break;

    case Rw2:
        cube[6] = cube_tmp[251];
        cube[7] = cube_tmp[252];
        cube[13] = cube_tmp[258];
        cube[14] = cube_tmp[259];
        cube[20] = cube_tmp[265];
        cube[21] = cube_tmp[266];
        cube[27] = cube_tmp[272];
        cube[28] = cube_tmp[273];
        cube[34] = cube_tmp[279];
        cube[35] = cube_tmp[280];
        cube[41] = cube_tmp[286];
        cube[42] = cube_tmp[287];
        cube[48] = cube_tmp[293];
        cube[49] = cube_tmp[294];
        cube[104] = cube_tmp[240];
        cube[105] = cube_tmp[239];
        cube[111] = cube_tmp[233];
        cube[112] = cube_tmp[232];
        cube[118] = cube_tmp[226];
        cube[119] = cube_tmp[225];
        cube[125] = cube_tmp[219];
        cube[126] = cube_tmp[218];
        cube[132] = cube_tmp[212];
        cube[133] = cube_tmp[211];
        cube[139] = cube_tmp[205];
        cube[140] = cube_tmp[204];
        cube[146] = cube_tmp[198];
        cube[147] = cube_tmp[197];
        cube[148] = cube_tmp[196];
        cube[149] = cube_tmp[195];
        cube[150] = cube_tmp[194];
        cube[151] = cube_tmp[193];
        cube[152] = cube_tmp[192];
        cube[153] = cube_tmp[191];
        cube[154] = cube_tmp[190];
        cube[155] = cube_tmp[189];
        cube[156] = cube_tmp[188];
        cube[157] = cube_tmp[187];
        cube[158] = cube_tmp[186];
        cube[159] = cube_tmp[185];
        cube[160] = cube_tmp[184];
        cube[161] = cube_tmp[183];
        cube[162] = cube_tmp[182];
        cube[163] = cube_tmp[181];
        cube[164] = cube_tmp[180];
        cube[165] = cube_tmp[179];
        cube[166] = cube_tmp[178];
        cube[167] = cube_tmp[177];
        cube[168] = cube_tmp[176];
        cube[169] = cube_tmp[175];
        cube[170] = cube_tmp[174];
        cube[171] = cube_tmp[173];
        cube[173] = cube_tmp[171];
        cube[174] = cube_tmp[170];
        cube[175] = cube_tmp[169];
        cube[176] = cube_tmp[168];
        cube[177] = cube_tmp[167];
        cube[178] = cube_tmp[166];
        cube[179] = cube_tmp[165];
        cube[180] = cube_tmp[164];
        cube[181] = cube_tmp[163];
        cube[182] = cube_tmp[162];
        cube[183] = cube_tmp[161];
        cube[184] = cube_tmp[160];
        cube[185] = cube_tmp[159];
        cube[186] = cube_tmp[158];
        cube[187] = cube_tmp[157];
        cube[188] = cube_tmp[156];
        cube[189] = cube_tmp[155];
        cube[190] = cube_tmp[154];
        cube[191] = cube_tmp[153];
        cube[192] = cube_tmp[152];
        cube[193] = cube_tmp[151];
        cube[194] = cube_tmp[150];
        cube[195] = cube_tmp[149];
        cube[196] = cube_tmp[148];
        cube[197] = cube_tmp[147];
        cube[198] = cube_tmp[146];
        cube[204] = cube_tmp[140];
        cube[205] = cube_tmp[139];
        cube[211] = cube_tmp[133];
        cube[212] = cube_tmp[132];
        cube[218] = cube_tmp[126];
        cube[219] = cube_tmp[125];
        cube[225] = cube_tmp[119];
        cube[226] = cube_tmp[118];
        cube[232] = cube_tmp[112];
        cube[233] = cube_tmp[111];
        cube[239] = cube_tmp[105];
        cube[240] = cube_tmp[104];
        cube[251] = cube_tmp[6];
        cube[252] = cube_tmp[7];
        cube[258] = cube_tmp[13];
        cube[259] = cube_tmp[14];
        cube[265] = cube_tmp[20];
        cube[266] = cube_tmp[21];
        cube[272] = cube_tmp[27];
        cube[273] = cube_tmp[28];
        cube[279] = cube_tmp[34];
        cube[280] = cube_tmp[35];
        cube[286] = cube_tmp[41];
        cube[287] = cube_tmp[42];
        cube[293] = cube_tmp[48];
        cube[294] = cube_tmp[49];
        break;

    case threeRw:
        cube[5] = cube_tmp[103];
        cube[6] = cube_tmp[104];
        cube[7] = cube_tmp[105];
        cube[12] = cube_tmp[110];
        cube[13] = cube_tmp[111];
        cube[14] = cube_tmp[112];
        cube[19] = cube_tmp[117];
        cube[20] = cube_tmp[118];
        cube[21] = cube_tmp[119];
        cube[26] = cube_tmp[124];
        cube[27] = cube_tmp[125];
        cube[28] = cube_tmp[126];
        cube[33] = cube_tmp[131];
        cube[34] = cube_tmp[132];
        cube[35] = cube_tmp[133];
        cube[40] = cube_tmp[138];
        cube[41] = cube_tmp[139];
        cube[42] = cube_tmp[140];
        cube[47] = cube_tmp[145];
        cube[48] = cube_tmp[146];
        cube[49] = cube_tmp[147];
        cube[103] = cube_tmp[250];
        cube[104] = cube_tmp[251];
        cube[105] = cube_tmp[252];
        cube[110] = cube_tmp[257];
        cube[111] = cube_tmp[258];
        cube[112] = cube_tmp[259];
        cube[117] = cube_tmp[264];
        cube[118] = cube_tmp[265];
        cube[119] = cube_tmp[266];
        cube[124] = cube_tmp[271];
        cube[125] = cube_tmp[272];
        cube[126] = cube_tmp[273];
        cube[131] = cube_tmp[278];
        cube[132] = cube_tmp[279];
        cube[133] = cube_tmp[280];
        cube[138] = cube_tmp[285];
        cube[139] = cube_tmp[286];
        cube[140] = cube_tmp[287];
        cube[145] = cube_tmp[292];
        cube[146] = cube_tmp[293];
        cube[147] = cube_tmp[294];
        cube[148] = cube_tmp[190];
        cube[149] = cube_tmp[183];
        cube[150] = cube_tmp[176];
        cube[151] = cube_tmp[169];
        cube[152] = cube_tmp[162];
        cube[153] = cube_tmp[155];
        cube[154] = cube_tmp[148];
        cube[155] = cube_tmp[191];
        cube[156] = cube_tmp[184];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[170];
        cube[159] = cube_tmp[163];
        cube[160] = cube_tmp[156];
        cube[161] = cube_tmp[149];
        cube[162] = cube_tmp[192];
        cube[163] = cube_tmp[185];
        cube[164] = cube_tmp[178];
        cube[165] = cube_tmp[171];
        cube[166] = cube_tmp[164];
        cube[167] = cube_tmp[157];
        cube[168] = cube_tmp[150];
        cube[169] = cube_tmp[193];
        cube[170] = cube_tmp[186];
        cube[171] = cube_tmp[179];
        cube[173] = cube_tmp[165];
        cube[174] = cube_tmp[158];
        cube[175] = cube_tmp[151];
        cube[176] = cube_tmp[194];
        cube[177] = cube_tmp[187];
        cube[178] = cube_tmp[180];
        cube[179] = cube_tmp[173];
        cube[180] = cube_tmp[166];
        cube[181] = cube_tmp[159];
        cube[182] = cube_tmp[152];
        cube[183] = cube_tmp[195];
        cube[184] = cube_tmp[188];
        cube[185] = cube_tmp[181];
        cube[186] = cube_tmp[174];
        cube[187] = cube_tmp[167];
        cube[188] = cube_tmp[160];
        cube[189] = cube_tmp[153];
        cube[190] = cube_tmp[196];
        cube[191] = cube_tmp[189];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[175];
        cube[194] = cube_tmp[168];
        cube[195] = cube_tmp[161];
        cube[196] = cube_tmp[154];
        cube[197] = cube_tmp[49];
        cube[198] = cube_tmp[48];
        cube[199] = cube_tmp[47];
        cube[204] = cube_tmp[42];
        cube[205] = cube_tmp[41];
        cube[206] = cube_tmp[40];
        cube[211] = cube_tmp[35];
        cube[212] = cube_tmp[34];
        cube[213] = cube_tmp[33];
        cube[218] = cube_tmp[28];
        cube[219] = cube_tmp[27];
        cube[220] = cube_tmp[26];
        cube[225] = cube_tmp[21];
        cube[226] = cube_tmp[20];
        cube[227] = cube_tmp[19];
        cube[232] = cube_tmp[14];
        cube[233] = cube_tmp[13];
        cube[234] = cube_tmp[12];
        cube[239] = cube_tmp[7];
        cube[240] = cube_tmp[6];
        cube[241] = cube_tmp[5];
        cube[250] = cube_tmp[241];
        cube[251] = cube_tmp[240];
        cube[252] = cube_tmp[239];
        cube[257] = cube_tmp[234];
        cube[258] = cube_tmp[233];
        cube[259] = cube_tmp[232];
        cube[264] = cube_tmp[227];
        cube[265] = cube_tmp[226];
        cube[266] = cube_tmp[225];
        cube[271] = cube_tmp[220];
        cube[272] = cube_tmp[219];
        cube[273] = cube_tmp[218];
        cube[278] = cube_tmp[213];
        cube[279] = cube_tmp[212];
        cube[280] = cube_tmp[211];
        cube[285] = cube_tmp[206];
        cube[286] = cube_tmp[205];
        cube[287] = cube_tmp[204];
        cube[292] = cube_tmp[199];
        cube[293] = cube_tmp[198];
        cube[294] = cube_tmp[197];
        break;

    case threeRw_PRIME:
        cube[5] = cube_tmp[241];
        cube[6] = cube_tmp[240];
        cube[7] = cube_tmp[239];
        cube[12] = cube_tmp[234];
        cube[13] = cube_tmp[233];
        cube[14] = cube_tmp[232];
        cube[19] = cube_tmp[227];
        cube[20] = cube_tmp[226];
        cube[21] = cube_tmp[225];
        cube[26] = cube_tmp[220];
        cube[27] = cube_tmp[219];
        cube[28] = cube_tmp[218];
        cube[33] = cube_tmp[213];
        cube[34] = cube_tmp[212];
        cube[35] = cube_tmp[211];
        cube[40] = cube_tmp[206];
        cube[41] = cube_tmp[205];
        cube[42] = cube_tmp[204];
        cube[47] = cube_tmp[199];
        cube[48] = cube_tmp[198];
        cube[49] = cube_tmp[197];
        cube[103] = cube_tmp[5];
        cube[104] = cube_tmp[6];
        cube[105] = cube_tmp[7];
        cube[110] = cube_tmp[12];
        cube[111] = cube_tmp[13];
        cube[112] = cube_tmp[14];
        cube[117] = cube_tmp[19];
        cube[118] = cube_tmp[20];
        cube[119] = cube_tmp[21];
        cube[124] = cube_tmp[26];
        cube[125] = cube_tmp[27];
        cube[126] = cube_tmp[28];
        cube[131] = cube_tmp[33];
        cube[132] = cube_tmp[34];
        cube[133] = cube_tmp[35];
        cube[138] = cube_tmp[40];
        cube[139] = cube_tmp[41];
        cube[140] = cube_tmp[42];
        cube[145] = cube_tmp[47];
        cube[146] = cube_tmp[48];
        cube[147] = cube_tmp[49];
        cube[148] = cube_tmp[154];
        cube[149] = cube_tmp[161];
        cube[150] = cube_tmp[168];
        cube[151] = cube_tmp[175];
        cube[152] = cube_tmp[182];
        cube[153] = cube_tmp[189];
        cube[154] = cube_tmp[196];
        cube[155] = cube_tmp[153];
        cube[156] = cube_tmp[160];
        cube[157] = cube_tmp[167];
        cube[158] = cube_tmp[174];
        cube[159] = cube_tmp[181];
        cube[160] = cube_tmp[188];
        cube[161] = cube_tmp[195];
        cube[162] = cube_tmp[152];
        cube[163] = cube_tmp[159];
        cube[164] = cube_tmp[166];
        cube[165] = cube_tmp[173];
        cube[166] = cube_tmp[180];
        cube[167] = cube_tmp[187];
        cube[168] = cube_tmp[194];
        cube[169] = cube_tmp[151];
        cube[170] = cube_tmp[158];
        cube[171] = cube_tmp[165];
        cube[173] = cube_tmp[179];
        cube[174] = cube_tmp[186];
        cube[175] = cube_tmp[193];
        cube[176] = cube_tmp[150];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[164];
        cube[179] = cube_tmp[171];
        cube[180] = cube_tmp[178];
        cube[181] = cube_tmp[185];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[149];
        cube[184] = cube_tmp[156];
        cube[185] = cube_tmp[163];
        cube[186] = cube_tmp[170];
        cube[187] = cube_tmp[177];
        cube[188] = cube_tmp[184];
        cube[189] = cube_tmp[191];
        cube[190] = cube_tmp[148];
        cube[191] = cube_tmp[155];
        cube[192] = cube_tmp[162];
        cube[193] = cube_tmp[169];
        cube[194] = cube_tmp[176];
        cube[195] = cube_tmp[183];
        cube[196] = cube_tmp[190];
        cube[197] = cube_tmp[294];
        cube[198] = cube_tmp[293];
        cube[199] = cube_tmp[292];
        cube[204] = cube_tmp[287];
        cube[205] = cube_tmp[286];
        cube[206] = cube_tmp[285];
        cube[211] = cube_tmp[280];
        cube[212] = cube_tmp[279];
        cube[213] = cube_tmp[278];
        cube[218] = cube_tmp[273];
        cube[219] = cube_tmp[272];
        cube[220] = cube_tmp[271];
        cube[225] = cube_tmp[266];
        cube[226] = cube_tmp[265];
        cube[227] = cube_tmp[264];
        cube[232] = cube_tmp[259];
        cube[233] = cube_tmp[258];
        cube[234] = cube_tmp[257];
        cube[239] = cube_tmp[252];
        cube[240] = cube_tmp[251];
        cube[241] = cube_tmp[250];
        cube[250] = cube_tmp[103];
        cube[251] = cube_tmp[104];
        cube[252] = cube_tmp[105];
        cube[257] = cube_tmp[110];
        cube[258] = cube_tmp[111];
        cube[259] = cube_tmp[112];
        cube[264] = cube_tmp[117];
        cube[265] = cube_tmp[118];
        cube[266] = cube_tmp[119];
        cube[271] = cube_tmp[124];
        cube[272] = cube_tmp[125];
        cube[273] = cube_tmp[126];
        cube[278] = cube_tmp[131];
        cube[279] = cube_tmp[132];
        cube[280] = cube_tmp[133];
        cube[285] = cube_tmp[138];
        cube[286] = cube_tmp[139];
        cube[287] = cube_tmp[140];
        cube[292] = cube_tmp[145];
        cube[293] = cube_tmp[146];
        cube[294] = cube_tmp[147];
        break;

    case threeRw2:
        cube[5] = cube_tmp[250];
        cube[6] = cube_tmp[251];
        cube[7] = cube_tmp[252];
        cube[12] = cube_tmp[257];
        cube[13] = cube_tmp[258];
        cube[14] = cube_tmp[259];
        cube[19] = cube_tmp[264];
        cube[20] = cube_tmp[265];
        cube[21] = cube_tmp[266];
        cube[26] = cube_tmp[271];
        cube[27] = cube_tmp[272];
        cube[28] = cube_tmp[273];
        cube[33] = cube_tmp[278];
        cube[34] = cube_tmp[279];
        cube[35] = cube_tmp[280];
        cube[40] = cube_tmp[285];
        cube[41] = cube_tmp[286];
        cube[42] = cube_tmp[287];
        cube[47] = cube_tmp[292];
        cube[48] = cube_tmp[293];
        cube[49] = cube_tmp[294];
        cube[103] = cube_tmp[241];
        cube[104] = cube_tmp[240];
        cube[105] = cube_tmp[239];
        cube[110] = cube_tmp[234];
        cube[111] = cube_tmp[233];
        cube[112] = cube_tmp[232];
        cube[117] = cube_tmp[227];
        cube[118] = cube_tmp[226];
        cube[119] = cube_tmp[225];
        cube[124] = cube_tmp[220];
        cube[125] = cube_tmp[219];
        cube[126] = cube_tmp[218];
        cube[131] = cube_tmp[213];
        cube[132] = cube_tmp[212];
        cube[133] = cube_tmp[211];
        cube[138] = cube_tmp[206];
        cube[139] = cube_tmp[205];
        cube[140] = cube_tmp[204];
        cube[145] = cube_tmp[199];
        cube[146] = cube_tmp[198];
        cube[147] = cube_tmp[197];
        cube[148] = cube_tmp[196];
        cube[149] = cube_tmp[195];
        cube[150] = cube_tmp[194];
        cube[151] = cube_tmp[193];
        cube[152] = cube_tmp[192];
        cube[153] = cube_tmp[191];
        cube[154] = cube_tmp[190];
        cube[155] = cube_tmp[189];
        cube[156] = cube_tmp[188];
        cube[157] = cube_tmp[187];
        cube[158] = cube_tmp[186];
        cube[159] = cube_tmp[185];
        cube[160] = cube_tmp[184];
        cube[161] = cube_tmp[183];
        cube[162] = cube_tmp[182];
        cube[163] = cube_tmp[181];
        cube[164] = cube_tmp[180];
        cube[165] = cube_tmp[179];
        cube[166] = cube_tmp[178];
        cube[167] = cube_tmp[177];
        cube[168] = cube_tmp[176];
        cube[169] = cube_tmp[175];
        cube[170] = cube_tmp[174];
        cube[171] = cube_tmp[173];
        cube[173] = cube_tmp[171];
        cube[174] = cube_tmp[170];
        cube[175] = cube_tmp[169];
        cube[176] = cube_tmp[168];
        cube[177] = cube_tmp[167];
        cube[178] = cube_tmp[166];
        cube[179] = cube_tmp[165];
        cube[180] = cube_tmp[164];
        cube[181] = cube_tmp[163];
        cube[182] = cube_tmp[162];
        cube[183] = cube_tmp[161];
        cube[184] = cube_tmp[160];
        cube[185] = cube_tmp[159];
        cube[186] = cube_tmp[158];
        cube[187] = cube_tmp[157];
        cube[188] = cube_tmp[156];
        cube[189] = cube_tmp[155];
        cube[190] = cube_tmp[154];
        cube[191] = cube_tmp[153];
        cube[192] = cube_tmp[152];
        cube[193] = cube_tmp[151];
        cube[194] = cube_tmp[150];
        cube[195] = cube_tmp[149];
        cube[196] = cube_tmp[148];
        cube[197] = cube_tmp[147];
        cube[198] = cube_tmp[146];
        cube[199] = cube_tmp[145];
        cube[204] = cube_tmp[140];
        cube[205] = cube_tmp[139];
        cube[206] = cube_tmp[138];
        cube[211] = cube_tmp[133];
        cube[212] = cube_tmp[132];
        cube[213] = cube_tmp[131];
        cube[218] = cube_tmp[126];
        cube[219] = cube_tmp[125];
        cube[220] = cube_tmp[124];
        cube[225] = cube_tmp[119];
        cube[226] = cube_tmp[118];
        cube[227] = cube_tmp[117];
        cube[232] = cube_tmp[112];
        cube[233] = cube_tmp[111];
        cube[234] = cube_tmp[110];
        cube[239] = cube_tmp[105];
        cube[240] = cube_tmp[104];
        cube[241] = cube_tmp[103];
        cube[250] = cube_tmp[5];
        cube[251] = cube_tmp[6];
        cube[252] = cube_tmp[7];
        cube[257] = cube_tmp[12];
        cube[258] = cube_tmp[13];
        cube[259] = cube_tmp[14];
        cube[264] = cube_tmp[19];
        cube[265] = cube_tmp[20];
        cube[266] = cube_tmp[21];
        cube[271] = cube_tmp[26];
        cube[272] = cube_tmp[27];
        cube[273] = cube_tmp[28];
        cube[278] = cube_tmp[33];
        cube[279] = cube_tmp[34];
        cube[280] = cube_tmp[35];
        cube[285] = cube_tmp[40];
        cube[286] = cube_tmp[41];
        cube[287] = cube_tmp[42];
        cube[292] = cube_tmp[47];
        cube[293] = cube_tmp[48];
        cube[294] = cube_tmp[49];
        break;

    case B:
        cube[1] = cube_tmp[154];
        cube[2] = cube_tmp[161];
        cube[3] = cube_tmp[168];
        cube[4] = cube_tmp[175];
        cube[5] = cube_tmp[182];
        cube[6] = cube_tmp[189];
        cube[7] = cube_tmp[196];
        cube[50] = cube_tmp[7];
        cube[57] = cube_tmp[6];
        cube[64] = cube_tmp[5];
        cube[71] = cube_tmp[4];
        cube[78] = cube_tmp[3];
        cube[85] = cube_tmp[2];
        cube[92] = cube_tmp[1];
        cube[154] = cube_tmp[294];
        cube[161] = cube_tmp[293];
        cube[168] = cube_tmp[292];
        cube[175] = cube_tmp[291];
        cube[182] = cube_tmp[290];
        cube[189] = cube_tmp[289];
        cube[196] = cube_tmp[288];
        cube[197] = cube_tmp[239];
        cube[198] = cube_tmp[232];
        cube[199] = cube_tmp[225];
        cube[200] = cube_tmp[218];
        cube[201] = cube_tmp[211];
        cube[202] = cube_tmp[204];
        cube[203] = cube_tmp[197];
        cube[204] = cube_tmp[240];
        cube[205] = cube_tmp[233];
        cube[206] = cube_tmp[226];
        cube[207] = cube_tmp[219];
        cube[208] = cube_tmp[212];
        cube[209] = cube_tmp[205];
        cube[210] = cube_tmp[198];
        cube[211] = cube_tmp[241];
        cube[212] = cube_tmp[234];
        cube[213] = cube_tmp[227];
        cube[214] = cube_tmp[220];
        cube[215] = cube_tmp[213];
        cube[216] = cube_tmp[206];
        cube[217] = cube_tmp[199];
        cube[218] = cube_tmp[242];
        cube[219] = cube_tmp[235];
        cube[220] = cube_tmp[228];
        cube[222] = cube_tmp[214];
        cube[223] = cube_tmp[207];
        cube[224] = cube_tmp[200];
        cube[225] = cube_tmp[243];
        cube[226] = cube_tmp[236];
        cube[227] = cube_tmp[229];
        cube[228] = cube_tmp[222];
        cube[229] = cube_tmp[215];
        cube[230] = cube_tmp[208];
        cube[231] = cube_tmp[201];
        cube[232] = cube_tmp[244];
        cube[233] = cube_tmp[237];
        cube[234] = cube_tmp[230];
        cube[235] = cube_tmp[223];
        cube[236] = cube_tmp[216];
        cube[237] = cube_tmp[209];
        cube[238] = cube_tmp[202];
        cube[239] = cube_tmp[245];
        cube[240] = cube_tmp[238];
        cube[241] = cube_tmp[231];
        cube[242] = cube_tmp[224];
        cube[243] = cube_tmp[217];
        cube[244] = cube_tmp[210];
        cube[245] = cube_tmp[203];
        cube[288] = cube_tmp[50];
        cube[289] = cube_tmp[57];
        cube[290] = cube_tmp[64];
        cube[291] = cube_tmp[71];
        cube[292] = cube_tmp[78];
        cube[293] = cube_tmp[85];
        cube[294] = cube_tmp[92];
        break;

    case B_PRIME:
        cube[1] = cube_tmp[92];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[71];
        cube[5] = cube_tmp[64];
        cube[6] = cube_tmp[57];
        cube[7] = cube_tmp[50];
        cube[50] = cube_tmp[288];
        cube[57] = cube_tmp[289];
        cube[64] = cube_tmp[290];
        cube[71] = cube_tmp[291];
        cube[78] = cube_tmp[292];
        cube[85] = cube_tmp[293];
        cube[92] = cube_tmp[294];
        cube[154] = cube_tmp[1];
        cube[161] = cube_tmp[2];
        cube[168] = cube_tmp[3];
        cube[175] = cube_tmp[4];
        cube[182] = cube_tmp[5];
        cube[189] = cube_tmp[6];
        cube[196] = cube_tmp[7];
        cube[197] = cube_tmp[203];
        cube[198] = cube_tmp[210];
        cube[199] = cube_tmp[217];
        cube[200] = cube_tmp[224];
        cube[201] = cube_tmp[231];
        cube[202] = cube_tmp[238];
        cube[203] = cube_tmp[245];
        cube[204] = cube_tmp[202];
        cube[205] = cube_tmp[209];
        cube[206] = cube_tmp[216];
        cube[207] = cube_tmp[223];
        cube[208] = cube_tmp[230];
        cube[209] = cube_tmp[237];
        cube[210] = cube_tmp[244];
        cube[211] = cube_tmp[201];
        cube[212] = cube_tmp[208];
        cube[213] = cube_tmp[215];
        cube[214] = cube_tmp[222];
        cube[215] = cube_tmp[229];
        cube[216] = cube_tmp[236];
        cube[217] = cube_tmp[243];
        cube[218] = cube_tmp[200];
        cube[219] = cube_tmp[207];
        cube[220] = cube_tmp[214];
        cube[222] = cube_tmp[228];
        cube[223] = cube_tmp[235];
        cube[224] = cube_tmp[242];
        cube[225] = cube_tmp[199];
        cube[226] = cube_tmp[206];
        cube[227] = cube_tmp[213];
        cube[228] = cube_tmp[220];
        cube[229] = cube_tmp[227];
        cube[230] = cube_tmp[234];
        cube[231] = cube_tmp[241];
        cube[232] = cube_tmp[198];
        cube[233] = cube_tmp[205];
        cube[234] = cube_tmp[212];
        cube[235] = cube_tmp[219];
        cube[236] = cube_tmp[226];
        cube[237] = cube_tmp[233];
        cube[238] = cube_tmp[240];
        cube[239] = cube_tmp[197];
        cube[240] = cube_tmp[204];
        cube[241] = cube_tmp[211];
        cube[242] = cube_tmp[218];
        cube[243] = cube_tmp[225];
        cube[244] = cube_tmp[232];
        cube[245] = cube_tmp[239];
        cube[288] = cube_tmp[196];
        cube[289] = cube_tmp[189];
        cube[290] = cube_tmp[182];
        cube[291] = cube_tmp[175];
        cube[292] = cube_tmp[168];
        cube[293] = cube_tmp[161];
        cube[294] = cube_tmp[154];
        break;

    case B2:
        cube[1] = cube_tmp[294];
        cube[2] = cube_tmp[293];
        cube[3] = cube_tmp[292];
        cube[4] = cube_tmp[291];
        cube[5] = cube_tmp[290];
        cube[6] = cube_tmp[289];
        cube[7] = cube_tmp[288];
        cube[50] = cube_tmp[196];
        cube[57] = cube_tmp[189];
        cube[64] = cube_tmp[182];
        cube[71] = cube_tmp[175];
        cube[78] = cube_tmp[168];
        cube[85] = cube_tmp[161];
        cube[92] = cube_tmp[154];
        cube[154] = cube_tmp[92];
        cube[161] = cube_tmp[85];
        cube[168] = cube_tmp[78];
        cube[175] = cube_tmp[71];
        cube[182] = cube_tmp[64];
        cube[189] = cube_tmp[57];
        cube[196] = cube_tmp[50];
        cube[197] = cube_tmp[245];
        cube[198] = cube_tmp[244];
        cube[199] = cube_tmp[243];
        cube[200] = cube_tmp[242];
        cube[201] = cube_tmp[241];
        cube[202] = cube_tmp[240];
        cube[203] = cube_tmp[239];
        cube[204] = cube_tmp[238];
        cube[205] = cube_tmp[237];
        cube[206] = cube_tmp[236];
        cube[207] = cube_tmp[235];
        cube[208] = cube_tmp[234];
        cube[209] = cube_tmp[233];
        cube[210] = cube_tmp[232];
        cube[211] = cube_tmp[231];
        cube[212] = cube_tmp[230];
        cube[213] = cube_tmp[229];
        cube[214] = cube_tmp[228];
        cube[215] = cube_tmp[227];
        cube[216] = cube_tmp[226];
        cube[217] = cube_tmp[225];
        cube[218] = cube_tmp[224];
        cube[219] = cube_tmp[223];
        cube[220] = cube_tmp[222];
        cube[222] = cube_tmp[220];
        cube[223] = cube_tmp[219];
        cube[224] = cube_tmp[218];
        cube[225] = cube_tmp[217];
        cube[226] = cube_tmp[216];
        cube[227] = cube_tmp[215];
        cube[228] = cube_tmp[214];
        cube[229] = cube_tmp[213];
        cube[230] = cube_tmp[212];
        cube[231] = cube_tmp[211];
        cube[232] = cube_tmp[210];
        cube[233] = cube_tmp[209];
        cube[234] = cube_tmp[208];
        cube[235] = cube_tmp[207];
        cube[236] = cube_tmp[206];
        cube[237] = cube_tmp[205];
        cube[238] = cube_tmp[204];
        cube[239] = cube_tmp[203];
        cube[240] = cube_tmp[202];
        cube[241] = cube_tmp[201];
        cube[242] = cube_tmp[200];
        cube[243] = cube_tmp[199];
        cube[244] = cube_tmp[198];
        cube[245] = cube_tmp[197];
        cube[288] = cube_tmp[7];
        cube[289] = cube_tmp[6];
        cube[290] = cube_tmp[5];
        cube[291] = cube_tmp[4];
        cube[292] = cube_tmp[3];
        cube[293] = cube_tmp[2];
        cube[294] = cube_tmp[1];
        break;

    case Bw:
        cube[1] = cube_tmp[154];
        cube[2] = cube_tmp[161];
        cube[3] = cube_tmp[168];
        cube[4] = cube_tmp[175];
        cube[5] = cube_tmp[182];
        cube[6] = cube_tmp[189];
        cube[7] = cube_tmp[196];
        cube[8] = cube_tmp[153];
        cube[9] = cube_tmp[160];
        cube[10] = cube_tmp[167];
        cube[11] = cube_tmp[174];
        cube[12] = cube_tmp[181];
        cube[13] = cube_tmp[188];
        cube[14] = cube_tmp[195];
        cube[50] = cube_tmp[7];
        cube[51] = cube_tmp[14];
        cube[57] = cube_tmp[6];
        cube[58] = cube_tmp[13];
        cube[64] = cube_tmp[5];
        cube[65] = cube_tmp[12];
        cube[71] = cube_tmp[4];
        cube[72] = cube_tmp[11];
        cube[78] = cube_tmp[3];
        cube[79] = cube_tmp[10];
        cube[85] = cube_tmp[2];
        cube[86] = cube_tmp[9];
        cube[92] = cube_tmp[1];
        cube[93] = cube_tmp[8];
        cube[153] = cube_tmp[287];
        cube[154] = cube_tmp[294];
        cube[160] = cube_tmp[286];
        cube[161] = cube_tmp[293];
        cube[167] = cube_tmp[285];
        cube[168] = cube_tmp[292];
        cube[174] = cube_tmp[284];
        cube[175] = cube_tmp[291];
        cube[181] = cube_tmp[283];
        cube[182] = cube_tmp[290];
        cube[188] = cube_tmp[282];
        cube[189] = cube_tmp[289];
        cube[195] = cube_tmp[281];
        cube[196] = cube_tmp[288];
        cube[197] = cube_tmp[239];
        cube[198] = cube_tmp[232];
        cube[199] = cube_tmp[225];
        cube[200] = cube_tmp[218];
        cube[201] = cube_tmp[211];
        cube[202] = cube_tmp[204];
        cube[203] = cube_tmp[197];
        cube[204] = cube_tmp[240];
        cube[205] = cube_tmp[233];
        cube[206] = cube_tmp[226];
        cube[207] = cube_tmp[219];
        cube[208] = cube_tmp[212];
        cube[209] = cube_tmp[205];
        cube[210] = cube_tmp[198];
        cube[211] = cube_tmp[241];
        cube[212] = cube_tmp[234];
        cube[213] = cube_tmp[227];
        cube[214] = cube_tmp[220];
        cube[215] = cube_tmp[213];
        cube[216] = cube_tmp[206];
        cube[217] = cube_tmp[199];
        cube[218] = cube_tmp[242];
        cube[219] = cube_tmp[235];
        cube[220] = cube_tmp[228];
        cube[222] = cube_tmp[214];
        cube[223] = cube_tmp[207];
        cube[224] = cube_tmp[200];
        cube[225] = cube_tmp[243];
        cube[226] = cube_tmp[236];
        cube[227] = cube_tmp[229];
        cube[228] = cube_tmp[222];
        cube[229] = cube_tmp[215];
        cube[230] = cube_tmp[208];
        cube[231] = cube_tmp[201];
        cube[232] = cube_tmp[244];
        cube[233] = cube_tmp[237];
        cube[234] = cube_tmp[230];
        cube[235] = cube_tmp[223];
        cube[236] = cube_tmp[216];
        cube[237] = cube_tmp[209];
        cube[238] = cube_tmp[202];
        cube[239] = cube_tmp[245];
        cube[240] = cube_tmp[238];
        cube[241] = cube_tmp[231];
        cube[242] = cube_tmp[224];
        cube[243] = cube_tmp[217];
        cube[244] = cube_tmp[210];
        cube[245] = cube_tmp[203];
        cube[281] = cube_tmp[51];
        cube[282] = cube_tmp[58];
        cube[283] = cube_tmp[65];
        cube[284] = cube_tmp[72];
        cube[285] = cube_tmp[79];
        cube[286] = cube_tmp[86];
        cube[287] = cube_tmp[93];
        cube[288] = cube_tmp[50];
        cube[289] = cube_tmp[57];
        cube[290] = cube_tmp[64];
        cube[291] = cube_tmp[71];
        cube[292] = cube_tmp[78];
        cube[293] = cube_tmp[85];
        cube[294] = cube_tmp[92];
        break;

    case Bw_PRIME:
        cube[1] = cube_tmp[92];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[71];
        cube[5] = cube_tmp[64];
        cube[6] = cube_tmp[57];
        cube[7] = cube_tmp[50];
        cube[8] = cube_tmp[93];
        cube[9] = cube_tmp[86];
        cube[10] = cube_tmp[79];
        cube[11] = cube_tmp[72];
        cube[12] = cube_tmp[65];
        cube[13] = cube_tmp[58];
        cube[14] = cube_tmp[51];
        cube[50] = cube_tmp[288];
        cube[51] = cube_tmp[281];
        cube[57] = cube_tmp[289];
        cube[58] = cube_tmp[282];
        cube[64] = cube_tmp[290];
        cube[65] = cube_tmp[283];
        cube[71] = cube_tmp[291];
        cube[72] = cube_tmp[284];
        cube[78] = cube_tmp[292];
        cube[79] = cube_tmp[285];
        cube[85] = cube_tmp[293];
        cube[86] = cube_tmp[286];
        cube[92] = cube_tmp[294];
        cube[93] = cube_tmp[287];
        cube[153] = cube_tmp[8];
        cube[154] = cube_tmp[1];
        cube[160] = cube_tmp[9];
        cube[161] = cube_tmp[2];
        cube[167] = cube_tmp[10];
        cube[168] = cube_tmp[3];
        cube[174] = cube_tmp[11];
        cube[175] = cube_tmp[4];
        cube[181] = cube_tmp[12];
        cube[182] = cube_tmp[5];
        cube[188] = cube_tmp[13];
        cube[189] = cube_tmp[6];
        cube[195] = cube_tmp[14];
        cube[196] = cube_tmp[7];
        cube[197] = cube_tmp[203];
        cube[198] = cube_tmp[210];
        cube[199] = cube_tmp[217];
        cube[200] = cube_tmp[224];
        cube[201] = cube_tmp[231];
        cube[202] = cube_tmp[238];
        cube[203] = cube_tmp[245];
        cube[204] = cube_tmp[202];
        cube[205] = cube_tmp[209];
        cube[206] = cube_tmp[216];
        cube[207] = cube_tmp[223];
        cube[208] = cube_tmp[230];
        cube[209] = cube_tmp[237];
        cube[210] = cube_tmp[244];
        cube[211] = cube_tmp[201];
        cube[212] = cube_tmp[208];
        cube[213] = cube_tmp[215];
        cube[214] = cube_tmp[222];
        cube[215] = cube_tmp[229];
        cube[216] = cube_tmp[236];
        cube[217] = cube_tmp[243];
        cube[218] = cube_tmp[200];
        cube[219] = cube_tmp[207];
        cube[220] = cube_tmp[214];
        cube[222] = cube_tmp[228];
        cube[223] = cube_tmp[235];
        cube[224] = cube_tmp[242];
        cube[225] = cube_tmp[199];
        cube[226] = cube_tmp[206];
        cube[227] = cube_tmp[213];
        cube[228] = cube_tmp[220];
        cube[229] = cube_tmp[227];
        cube[230] = cube_tmp[234];
        cube[231] = cube_tmp[241];
        cube[232] = cube_tmp[198];
        cube[233] = cube_tmp[205];
        cube[234] = cube_tmp[212];
        cube[235] = cube_tmp[219];
        cube[236] = cube_tmp[226];
        cube[237] = cube_tmp[233];
        cube[238] = cube_tmp[240];
        cube[239] = cube_tmp[197];
        cube[240] = cube_tmp[204];
        cube[241] = cube_tmp[211];
        cube[242] = cube_tmp[218];
        cube[243] = cube_tmp[225];
        cube[244] = cube_tmp[232];
        cube[245] = cube_tmp[239];
        cube[281] = cube_tmp[195];
        cube[282] = cube_tmp[188];
        cube[283] = cube_tmp[181];
        cube[284] = cube_tmp[174];
        cube[285] = cube_tmp[167];
        cube[286] = cube_tmp[160];
        cube[287] = cube_tmp[153];
        cube[288] = cube_tmp[196];
        cube[289] = cube_tmp[189];
        cube[290] = cube_tmp[182];
        cube[291] = cube_tmp[175];
        cube[292] = cube_tmp[168];
        cube[293] = cube_tmp[161];
        cube[294] = cube_tmp[154];
        break;

    case Bw2:
        cube[1] = cube_tmp[294];
        cube[2] = cube_tmp[293];
        cube[3] = cube_tmp[292];
        cube[4] = cube_tmp[291];
        cube[5] = cube_tmp[290];
        cube[6] = cube_tmp[289];
        cube[7] = cube_tmp[288];
        cube[8] = cube_tmp[287];
        cube[9] = cube_tmp[286];
        cube[10] = cube_tmp[285];
        cube[11] = cube_tmp[284];
        cube[12] = cube_tmp[283];
        cube[13] = cube_tmp[282];
        cube[14] = cube_tmp[281];
        cube[50] = cube_tmp[196];
        cube[51] = cube_tmp[195];
        cube[57] = cube_tmp[189];
        cube[58] = cube_tmp[188];
        cube[64] = cube_tmp[182];
        cube[65] = cube_tmp[181];
        cube[71] = cube_tmp[175];
        cube[72] = cube_tmp[174];
        cube[78] = cube_tmp[168];
        cube[79] = cube_tmp[167];
        cube[85] = cube_tmp[161];
        cube[86] = cube_tmp[160];
        cube[92] = cube_tmp[154];
        cube[93] = cube_tmp[153];
        cube[153] = cube_tmp[93];
        cube[154] = cube_tmp[92];
        cube[160] = cube_tmp[86];
        cube[161] = cube_tmp[85];
        cube[167] = cube_tmp[79];
        cube[168] = cube_tmp[78];
        cube[174] = cube_tmp[72];
        cube[175] = cube_tmp[71];
        cube[181] = cube_tmp[65];
        cube[182] = cube_tmp[64];
        cube[188] = cube_tmp[58];
        cube[189] = cube_tmp[57];
        cube[195] = cube_tmp[51];
        cube[196] = cube_tmp[50];
        cube[197] = cube_tmp[245];
        cube[198] = cube_tmp[244];
        cube[199] = cube_tmp[243];
        cube[200] = cube_tmp[242];
        cube[201] = cube_tmp[241];
        cube[202] = cube_tmp[240];
        cube[203] = cube_tmp[239];
        cube[204] = cube_tmp[238];
        cube[205] = cube_tmp[237];
        cube[206] = cube_tmp[236];
        cube[207] = cube_tmp[235];
        cube[208] = cube_tmp[234];
        cube[209] = cube_tmp[233];
        cube[210] = cube_tmp[232];
        cube[211] = cube_tmp[231];
        cube[212] = cube_tmp[230];
        cube[213] = cube_tmp[229];
        cube[214] = cube_tmp[228];
        cube[215] = cube_tmp[227];
        cube[216] = cube_tmp[226];
        cube[217] = cube_tmp[225];
        cube[218] = cube_tmp[224];
        cube[219] = cube_tmp[223];
        cube[220] = cube_tmp[222];
        cube[222] = cube_tmp[220];
        cube[223] = cube_tmp[219];
        cube[224] = cube_tmp[218];
        cube[225] = cube_tmp[217];
        cube[226] = cube_tmp[216];
        cube[227] = cube_tmp[215];
        cube[228] = cube_tmp[214];
        cube[229] = cube_tmp[213];
        cube[230] = cube_tmp[212];
        cube[231] = cube_tmp[211];
        cube[232] = cube_tmp[210];
        cube[233] = cube_tmp[209];
        cube[234] = cube_tmp[208];
        cube[235] = cube_tmp[207];
        cube[236] = cube_tmp[206];
        cube[237] = cube_tmp[205];
        cube[238] = cube_tmp[204];
        cube[239] = cube_tmp[203];
        cube[240] = cube_tmp[202];
        cube[241] = cube_tmp[201];
        cube[242] = cube_tmp[200];
        cube[243] = cube_tmp[199];
        cube[244] = cube_tmp[198];
        cube[245] = cube_tmp[197];
        cube[281] = cube_tmp[14];
        cube[282] = cube_tmp[13];
        cube[283] = cube_tmp[12];
        cube[284] = cube_tmp[11];
        cube[285] = cube_tmp[10];
        cube[286] = cube_tmp[9];
        cube[287] = cube_tmp[8];
        cube[288] = cube_tmp[7];
        cube[289] = cube_tmp[6];
        cube[290] = cube_tmp[5];
        cube[291] = cube_tmp[4];
        cube[292] = cube_tmp[3];
        cube[293] = cube_tmp[2];
        cube[294] = cube_tmp[1];
        break;

    case threeBw:
        cube[1] = cube_tmp[154];
        cube[2] = cube_tmp[161];
        cube[3] = cube_tmp[168];
        cube[4] = cube_tmp[175];
        cube[5] = cube_tmp[182];
        cube[6] = cube_tmp[189];
        cube[7] = cube_tmp[196];
        cube[8] = cube_tmp[153];
        cube[9] = cube_tmp[160];
        cube[10] = cube_tmp[167];
        cube[11] = cube_tmp[174];
        cube[12] = cube_tmp[181];
        cube[13] = cube_tmp[188];
        cube[14] = cube_tmp[195];
        cube[15] = cube_tmp[152];
        cube[16] = cube_tmp[159];
        cube[17] = cube_tmp[166];
        cube[18] = cube_tmp[173];
        cube[19] = cube_tmp[180];
        cube[20] = cube_tmp[187];
        cube[21] = cube_tmp[194];
        cube[50] = cube_tmp[7];
        cube[51] = cube_tmp[14];
        cube[52] = cube_tmp[21];
        cube[57] = cube_tmp[6];
        cube[58] = cube_tmp[13];
        cube[59] = cube_tmp[20];
        cube[64] = cube_tmp[5];
        cube[65] = cube_tmp[12];
        cube[66] = cube_tmp[19];
        cube[71] = cube_tmp[4];
        cube[72] = cube_tmp[11];
        cube[73] = cube_tmp[18];
        cube[78] = cube_tmp[3];
        cube[79] = cube_tmp[10];
        cube[80] = cube_tmp[17];
        cube[85] = cube_tmp[2];
        cube[86] = cube_tmp[9];
        cube[87] = cube_tmp[16];
        cube[92] = cube_tmp[1];
        cube[93] = cube_tmp[8];
        cube[94] = cube_tmp[15];
        cube[152] = cube_tmp[280];
        cube[153] = cube_tmp[287];
        cube[154] = cube_tmp[294];
        cube[159] = cube_tmp[279];
        cube[160] = cube_tmp[286];
        cube[161] = cube_tmp[293];
        cube[166] = cube_tmp[278];
        cube[167] = cube_tmp[285];
        cube[168] = cube_tmp[292];
        cube[173] = cube_tmp[277];
        cube[174] = cube_tmp[284];
        cube[175] = cube_tmp[291];
        cube[180] = cube_tmp[276];
        cube[181] = cube_tmp[283];
        cube[182] = cube_tmp[290];
        cube[187] = cube_tmp[275];
        cube[188] = cube_tmp[282];
        cube[189] = cube_tmp[289];
        cube[194] = cube_tmp[274];
        cube[195] = cube_tmp[281];
        cube[196] = cube_tmp[288];
        cube[197] = cube_tmp[239];
        cube[198] = cube_tmp[232];
        cube[199] = cube_tmp[225];
        cube[200] = cube_tmp[218];
        cube[201] = cube_tmp[211];
        cube[202] = cube_tmp[204];
        cube[203] = cube_tmp[197];
        cube[204] = cube_tmp[240];
        cube[205] = cube_tmp[233];
        cube[206] = cube_tmp[226];
        cube[207] = cube_tmp[219];
        cube[208] = cube_tmp[212];
        cube[209] = cube_tmp[205];
        cube[210] = cube_tmp[198];
        cube[211] = cube_tmp[241];
        cube[212] = cube_tmp[234];
        cube[213] = cube_tmp[227];
        cube[214] = cube_tmp[220];
        cube[215] = cube_tmp[213];
        cube[216] = cube_tmp[206];
        cube[217] = cube_tmp[199];
        cube[218] = cube_tmp[242];
        cube[219] = cube_tmp[235];
        cube[220] = cube_tmp[228];
        cube[222] = cube_tmp[214];
        cube[223] = cube_tmp[207];
        cube[224] = cube_tmp[200];
        cube[225] = cube_tmp[243];
        cube[226] = cube_tmp[236];
        cube[227] = cube_tmp[229];
        cube[228] = cube_tmp[222];
        cube[229] = cube_tmp[215];
        cube[230] = cube_tmp[208];
        cube[231] = cube_tmp[201];
        cube[232] = cube_tmp[244];
        cube[233] = cube_tmp[237];
        cube[234] = cube_tmp[230];
        cube[235] = cube_tmp[223];
        cube[236] = cube_tmp[216];
        cube[237] = cube_tmp[209];
        cube[238] = cube_tmp[202];
        cube[239] = cube_tmp[245];
        cube[240] = cube_tmp[238];
        cube[241] = cube_tmp[231];
        cube[242] = cube_tmp[224];
        cube[243] = cube_tmp[217];
        cube[244] = cube_tmp[210];
        cube[245] = cube_tmp[203];
        cube[274] = cube_tmp[52];
        cube[275] = cube_tmp[59];
        cube[276] = cube_tmp[66];
        cube[277] = cube_tmp[73];
        cube[278] = cube_tmp[80];
        cube[279] = cube_tmp[87];
        cube[280] = cube_tmp[94];
        cube[281] = cube_tmp[51];
        cube[282] = cube_tmp[58];
        cube[283] = cube_tmp[65];
        cube[284] = cube_tmp[72];
        cube[285] = cube_tmp[79];
        cube[286] = cube_tmp[86];
        cube[287] = cube_tmp[93];
        cube[288] = cube_tmp[50];
        cube[289] = cube_tmp[57];
        cube[290] = cube_tmp[64];
        cube[291] = cube_tmp[71];
        cube[292] = cube_tmp[78];
        cube[293] = cube_tmp[85];
        cube[294] = cube_tmp[92];
        break;

    case threeBw_PRIME:
        cube[1] = cube_tmp[92];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[71];
        cube[5] = cube_tmp[64];
        cube[6] = cube_tmp[57];
        cube[7] = cube_tmp[50];
        cube[8] = cube_tmp[93];
        cube[9] = cube_tmp[86];
        cube[10] = cube_tmp[79];
        cube[11] = cube_tmp[72];
        cube[12] = cube_tmp[65];
        cube[13] = cube_tmp[58];
        cube[14] = cube_tmp[51];
        cube[15] = cube_tmp[94];
        cube[16] = cube_tmp[87];
        cube[17] = cube_tmp[80];
        cube[18] = cube_tmp[73];
        cube[19] = cube_tmp[66];
        cube[20] = cube_tmp[59];
        cube[21] = cube_tmp[52];
        cube[50] = cube_tmp[288];
        cube[51] = cube_tmp[281];
        cube[52] = cube_tmp[274];
        cube[57] = cube_tmp[289];
        cube[58] = cube_tmp[282];
        cube[59] = cube_tmp[275];
        cube[64] = cube_tmp[290];
        cube[65] = cube_tmp[283];
        cube[66] = cube_tmp[276];
        cube[71] = cube_tmp[291];
        cube[72] = cube_tmp[284];
        cube[73] = cube_tmp[277];
        cube[78] = cube_tmp[292];
        cube[79] = cube_tmp[285];
        cube[80] = cube_tmp[278];
        cube[85] = cube_tmp[293];
        cube[86] = cube_tmp[286];
        cube[87] = cube_tmp[279];
        cube[92] = cube_tmp[294];
        cube[93] = cube_tmp[287];
        cube[94] = cube_tmp[280];
        cube[152] = cube_tmp[15];
        cube[153] = cube_tmp[8];
        cube[154] = cube_tmp[1];
        cube[159] = cube_tmp[16];
        cube[160] = cube_tmp[9];
        cube[161] = cube_tmp[2];
        cube[166] = cube_tmp[17];
        cube[167] = cube_tmp[10];
        cube[168] = cube_tmp[3];
        cube[173] = cube_tmp[18];
        cube[174] = cube_tmp[11];
        cube[175] = cube_tmp[4];
        cube[180] = cube_tmp[19];
        cube[181] = cube_tmp[12];
        cube[182] = cube_tmp[5];
        cube[187] = cube_tmp[20];
        cube[188] = cube_tmp[13];
        cube[189] = cube_tmp[6];
        cube[194] = cube_tmp[21];
        cube[195] = cube_tmp[14];
        cube[196] = cube_tmp[7];
        cube[197] = cube_tmp[203];
        cube[198] = cube_tmp[210];
        cube[199] = cube_tmp[217];
        cube[200] = cube_tmp[224];
        cube[201] = cube_tmp[231];
        cube[202] = cube_tmp[238];
        cube[203] = cube_tmp[245];
        cube[204] = cube_tmp[202];
        cube[205] = cube_tmp[209];
        cube[206] = cube_tmp[216];
        cube[207] = cube_tmp[223];
        cube[208] = cube_tmp[230];
        cube[209] = cube_tmp[237];
        cube[210] = cube_tmp[244];
        cube[211] = cube_tmp[201];
        cube[212] = cube_tmp[208];
        cube[213] = cube_tmp[215];
        cube[214] = cube_tmp[222];
        cube[215] = cube_tmp[229];
        cube[216] = cube_tmp[236];
        cube[217] = cube_tmp[243];
        cube[218] = cube_tmp[200];
        cube[219] = cube_tmp[207];
        cube[220] = cube_tmp[214];
        cube[222] = cube_tmp[228];
        cube[223] = cube_tmp[235];
        cube[224] = cube_tmp[242];
        cube[225] = cube_tmp[199];
        cube[226] = cube_tmp[206];
        cube[227] = cube_tmp[213];
        cube[228] = cube_tmp[220];
        cube[229] = cube_tmp[227];
        cube[230] = cube_tmp[234];
        cube[231] = cube_tmp[241];
        cube[232] = cube_tmp[198];
        cube[233] = cube_tmp[205];
        cube[234] = cube_tmp[212];
        cube[235] = cube_tmp[219];
        cube[236] = cube_tmp[226];
        cube[237] = cube_tmp[233];
        cube[238] = cube_tmp[240];
        cube[239] = cube_tmp[197];
        cube[240] = cube_tmp[204];
        cube[241] = cube_tmp[211];
        cube[242] = cube_tmp[218];
        cube[243] = cube_tmp[225];
        cube[244] = cube_tmp[232];
        cube[245] = cube_tmp[239];
        cube[274] = cube_tmp[194];
        cube[275] = cube_tmp[187];
        cube[276] = cube_tmp[180];
        cube[277] = cube_tmp[173];
        cube[278] = cube_tmp[166];
        cube[279] = cube_tmp[159];
        cube[280] = cube_tmp[152];
        cube[281] = cube_tmp[195];
        cube[282] = cube_tmp[188];
        cube[283] = cube_tmp[181];
        cube[284] = cube_tmp[174];
        cube[285] = cube_tmp[167];
        cube[286] = cube_tmp[160];
        cube[287] = cube_tmp[153];
        cube[288] = cube_tmp[196];
        cube[289] = cube_tmp[189];
        cube[290] = cube_tmp[182];
        cube[291] = cube_tmp[175];
        cube[292] = cube_tmp[168];
        cube[293] = cube_tmp[161];
        cube[294] = cube_tmp[154];
        break;

    case threeBw2:
        cube[1] = cube_tmp[294];
        cube[2] = cube_tmp[293];
        cube[3] = cube_tmp[292];
        cube[4] = cube_tmp[291];
        cube[5] = cube_tmp[290];
        cube[6] = cube_tmp[289];
        cube[7] = cube_tmp[288];
        cube[8] = cube_tmp[287];
        cube[9] = cube_tmp[286];
        cube[10] = cube_tmp[285];
        cube[11] = cube_tmp[284];
        cube[12] = cube_tmp[283];
        cube[13] = cube_tmp[282];
        cube[14] = cube_tmp[281];
        cube[15] = cube_tmp[280];
        cube[16] = cube_tmp[279];
        cube[17] = cube_tmp[278];
        cube[18] = cube_tmp[277];
        cube[19] = cube_tmp[276];
        cube[20] = cube_tmp[275];
        cube[21] = cube_tmp[274];
        cube[50] = cube_tmp[196];
        cube[51] = cube_tmp[195];
        cube[52] = cube_tmp[194];
        cube[57] = cube_tmp[189];
        cube[58] = cube_tmp[188];
        cube[59] = cube_tmp[187];
        cube[64] = cube_tmp[182];
        cube[65] = cube_tmp[181];
        cube[66] = cube_tmp[180];
        cube[71] = cube_tmp[175];
        cube[72] = cube_tmp[174];
        cube[73] = cube_tmp[173];
        cube[78] = cube_tmp[168];
        cube[79] = cube_tmp[167];
        cube[80] = cube_tmp[166];
        cube[85] = cube_tmp[161];
        cube[86] = cube_tmp[160];
        cube[87] = cube_tmp[159];
        cube[92] = cube_tmp[154];
        cube[93] = cube_tmp[153];
        cube[94] = cube_tmp[152];
        cube[152] = cube_tmp[94];
        cube[153] = cube_tmp[93];
        cube[154] = cube_tmp[92];
        cube[159] = cube_tmp[87];
        cube[160] = cube_tmp[86];
        cube[161] = cube_tmp[85];
        cube[166] = cube_tmp[80];
        cube[167] = cube_tmp[79];
        cube[168] = cube_tmp[78];
        cube[173] = cube_tmp[73];
        cube[174] = cube_tmp[72];
        cube[175] = cube_tmp[71];
        cube[180] = cube_tmp[66];
        cube[181] = cube_tmp[65];
        cube[182] = cube_tmp[64];
        cube[187] = cube_tmp[59];
        cube[188] = cube_tmp[58];
        cube[189] = cube_tmp[57];
        cube[194] = cube_tmp[52];
        cube[195] = cube_tmp[51];
        cube[196] = cube_tmp[50];
        cube[197] = cube_tmp[245];
        cube[198] = cube_tmp[244];
        cube[199] = cube_tmp[243];
        cube[200] = cube_tmp[242];
        cube[201] = cube_tmp[241];
        cube[202] = cube_tmp[240];
        cube[203] = cube_tmp[239];
        cube[204] = cube_tmp[238];
        cube[205] = cube_tmp[237];
        cube[206] = cube_tmp[236];
        cube[207] = cube_tmp[235];
        cube[208] = cube_tmp[234];
        cube[209] = cube_tmp[233];
        cube[210] = cube_tmp[232];
        cube[211] = cube_tmp[231];
        cube[212] = cube_tmp[230];
        cube[213] = cube_tmp[229];
        cube[214] = cube_tmp[228];
        cube[215] = cube_tmp[227];
        cube[216] = cube_tmp[226];
        cube[217] = cube_tmp[225];
        cube[218] = cube_tmp[224];
        cube[219] = cube_tmp[223];
        cube[220] = cube_tmp[222];
        cube[222] = cube_tmp[220];
        cube[223] = cube_tmp[219];
        cube[224] = cube_tmp[218];
        cube[225] = cube_tmp[217];
        cube[226] = cube_tmp[216];
        cube[227] = cube_tmp[215];
        cube[228] = cube_tmp[214];
        cube[229] = cube_tmp[213];
        cube[230] = cube_tmp[212];
        cube[231] = cube_tmp[211];
        cube[232] = cube_tmp[210];
        cube[233] = cube_tmp[209];
        cube[234] = cube_tmp[208];
        cube[235] = cube_tmp[207];
        cube[236] = cube_tmp[206];
        cube[237] = cube_tmp[205];
        cube[238] = cube_tmp[204];
        cube[239] = cube_tmp[203];
        cube[240] = cube_tmp[202];
        cube[241] = cube_tmp[201];
        cube[242] = cube_tmp[200];
        cube[243] = cube_tmp[199];
        cube[244] = cube_tmp[198];
        cube[245] = cube_tmp[197];
        cube[274] = cube_tmp[21];
        cube[275] = cube_tmp[20];
        cube[276] = cube_tmp[19];
        cube[277] = cube_tmp[18];
        cube[278] = cube_tmp[17];
        cube[279] = cube_tmp[16];
        cube[280] = cube_tmp[15];
        cube[281] = cube_tmp[14];
        cube[282] = cube_tmp[13];
        cube[283] = cube_tmp[12];
        cube[284] = cube_tmp[11];
        cube[285] = cube_tmp[10];
        cube[286] = cube_tmp[9];
        cube[287] = cube_tmp[8];
        cube[288] = cube_tmp[7];
        cube[289] = cube_tmp[6];
        cube[290] = cube_tmp[5];
        cube[291] = cube_tmp[4];
        cube[292] = cube_tmp[3];
        cube[293] = cube_tmp[2];
        cube[294] = cube_tmp[1];
        break;

    case D:
        cube[92] = cube_tmp[239];
        cube[93] = cube_tmp[240];
        cube[94] = cube_tmp[241];
        cube[95] = cube_tmp[242];
        cube[96] = cube_tmp[243];
        cube[97] = cube_tmp[244];
        cube[98] = cube_tmp[245];
        cube[141] = cube_tmp[92];
        cube[142] = cube_tmp[93];
        cube[143] = cube_tmp[94];
        cube[144] = cube_tmp[95];
        cube[145] = cube_tmp[96];
        cube[146] = cube_tmp[97];
        cube[147] = cube_tmp[98];
        cube[190] = cube_tmp[141];
        cube[191] = cube_tmp[142];
        cube[192] = cube_tmp[143];
        cube[193] = cube_tmp[144];
        cube[194] = cube_tmp[145];
        cube[195] = cube_tmp[146];
        cube[196] = cube_tmp[147];
        cube[239] = cube_tmp[190];
        cube[240] = cube_tmp[191];
        cube[241] = cube_tmp[192];
        cube[242] = cube_tmp[193];
        cube[243] = cube_tmp[194];
        cube[244] = cube_tmp[195];
        cube[245] = cube_tmp[196];
        cube[246] = cube_tmp[288];
        cube[247] = cube_tmp[281];
        cube[248] = cube_tmp[274];
        cube[249] = cube_tmp[267];
        cube[250] = cube_tmp[260];
        cube[251] = cube_tmp[253];
        cube[252] = cube_tmp[246];
        cube[253] = cube_tmp[289];
        cube[254] = cube_tmp[282];
        cube[255] = cube_tmp[275];
        cube[256] = cube_tmp[268];
        cube[257] = cube_tmp[261];
        cube[258] = cube_tmp[254];
        cube[259] = cube_tmp[247];
        cube[260] = cube_tmp[290];
        cube[261] = cube_tmp[283];
        cube[262] = cube_tmp[276];
        cube[263] = cube_tmp[269];
        cube[264] = cube_tmp[262];
        cube[265] = cube_tmp[255];
        cube[266] = cube_tmp[248];
        cube[267] = cube_tmp[291];
        cube[268] = cube_tmp[284];
        cube[269] = cube_tmp[277];
        cube[271] = cube_tmp[263];
        cube[272] = cube_tmp[256];
        cube[273] = cube_tmp[249];
        cube[274] = cube_tmp[292];
        cube[275] = cube_tmp[285];
        cube[276] = cube_tmp[278];
        cube[277] = cube_tmp[271];
        cube[278] = cube_tmp[264];
        cube[279] = cube_tmp[257];
        cube[280] = cube_tmp[250];
        cube[281] = cube_tmp[293];
        cube[282] = cube_tmp[286];
        cube[283] = cube_tmp[279];
        cube[284] = cube_tmp[272];
        cube[285] = cube_tmp[265];
        cube[286] = cube_tmp[258];
        cube[287] = cube_tmp[251];
        cube[288] = cube_tmp[294];
        cube[289] = cube_tmp[287];
        cube[290] = cube_tmp[280];
        cube[291] = cube_tmp[273];
        cube[292] = cube_tmp[266];
        cube[293] = cube_tmp[259];
        cube[294] = cube_tmp[252];
        break;

    case D_PRIME:
        cube[92] = cube_tmp[141];
        cube[93] = cube_tmp[142];
        cube[94] = cube_tmp[143];
        cube[95] = cube_tmp[144];
        cube[96] = cube_tmp[145];
        cube[97] = cube_tmp[146];
        cube[98] = cube_tmp[147];
        cube[141] = cube_tmp[190];
        cube[142] = cube_tmp[191];
        cube[143] = cube_tmp[192];
        cube[144] = cube_tmp[193];
        cube[145] = cube_tmp[194];
        cube[146] = cube_tmp[195];
        cube[147] = cube_tmp[196];
        cube[190] = cube_tmp[239];
        cube[191] = cube_tmp[240];
        cube[192] = cube_tmp[241];
        cube[193] = cube_tmp[242];
        cube[194] = cube_tmp[243];
        cube[195] = cube_tmp[244];
        cube[196] = cube_tmp[245];
        cube[239] = cube_tmp[92];
        cube[240] = cube_tmp[93];
        cube[241] = cube_tmp[94];
        cube[242] = cube_tmp[95];
        cube[243] = cube_tmp[96];
        cube[244] = cube_tmp[97];
        cube[245] = cube_tmp[98];
        cube[246] = cube_tmp[252];
        cube[247] = cube_tmp[259];
        cube[248] = cube_tmp[266];
        cube[249] = cube_tmp[273];
        cube[250] = cube_tmp[280];
        cube[251] = cube_tmp[287];
        cube[252] = cube_tmp[294];
        cube[253] = cube_tmp[251];
        cube[254] = cube_tmp[258];
        cube[255] = cube_tmp[265];
        cube[256] = cube_tmp[272];
        cube[257] = cube_tmp[279];
        cube[258] = cube_tmp[286];
        cube[259] = cube_tmp[293];
        cube[260] = cube_tmp[250];
        cube[261] = cube_tmp[257];
        cube[262] = cube_tmp[264];
        cube[263] = cube_tmp[271];
        cube[264] = cube_tmp[278];
        cube[265] = cube_tmp[285];
        cube[266] = cube_tmp[292];
        cube[267] = cube_tmp[249];
        cube[268] = cube_tmp[256];
        cube[269] = cube_tmp[263];
        cube[271] = cube_tmp[277];
        cube[272] = cube_tmp[284];
        cube[273] = cube_tmp[291];
        cube[274] = cube_tmp[248];
        cube[275] = cube_tmp[255];
        cube[276] = cube_tmp[262];
        cube[277] = cube_tmp[269];
        cube[278] = cube_tmp[276];
        cube[279] = cube_tmp[283];
        cube[280] = cube_tmp[290];
        cube[281] = cube_tmp[247];
        cube[282] = cube_tmp[254];
        cube[283] = cube_tmp[261];
        cube[284] = cube_tmp[268];
        cube[285] = cube_tmp[275];
        cube[286] = cube_tmp[282];
        cube[287] = cube_tmp[289];
        cube[288] = cube_tmp[246];
        cube[289] = cube_tmp[253];
        cube[290] = cube_tmp[260];
        cube[291] = cube_tmp[267];
        cube[292] = cube_tmp[274];
        cube[293] = cube_tmp[281];
        cube[294] = cube_tmp[288];
        break;

    case D2:
        cube[92] = cube_tmp[190];
        cube[93] = cube_tmp[191];
        cube[94] = cube_tmp[192];
        cube[95] = cube_tmp[193];
        cube[96] = cube_tmp[194];
        cube[97] = cube_tmp[195];
        cube[98] = cube_tmp[196];
        cube[141] = cube_tmp[239];
        cube[142] = cube_tmp[240];
        cube[143] = cube_tmp[241];
        cube[144] = cube_tmp[242];
        cube[145] = cube_tmp[243];
        cube[146] = cube_tmp[244];
        cube[147] = cube_tmp[245];
        cube[190] = cube_tmp[92];
        cube[191] = cube_tmp[93];
        cube[192] = cube_tmp[94];
        cube[193] = cube_tmp[95];
        cube[194] = cube_tmp[96];
        cube[195] = cube_tmp[97];
        cube[196] = cube_tmp[98];
        cube[239] = cube_tmp[141];
        cube[240] = cube_tmp[142];
        cube[241] = cube_tmp[143];
        cube[242] = cube_tmp[144];
        cube[243] = cube_tmp[145];
        cube[244] = cube_tmp[146];
        cube[245] = cube_tmp[147];
        cube[246] = cube_tmp[294];
        cube[247] = cube_tmp[293];
        cube[248] = cube_tmp[292];
        cube[249] = cube_tmp[291];
        cube[250] = cube_tmp[290];
        cube[251] = cube_tmp[289];
        cube[252] = cube_tmp[288];
        cube[253] = cube_tmp[287];
        cube[254] = cube_tmp[286];
        cube[255] = cube_tmp[285];
        cube[256] = cube_tmp[284];
        cube[257] = cube_tmp[283];
        cube[258] = cube_tmp[282];
        cube[259] = cube_tmp[281];
        cube[260] = cube_tmp[280];
        cube[261] = cube_tmp[279];
        cube[262] = cube_tmp[278];
        cube[263] = cube_tmp[277];
        cube[264] = cube_tmp[276];
        cube[265] = cube_tmp[275];
        cube[266] = cube_tmp[274];
        cube[267] = cube_tmp[273];
        cube[268] = cube_tmp[272];
        cube[269] = cube_tmp[271];
        cube[271] = cube_tmp[269];
        cube[272] = cube_tmp[268];
        cube[273] = cube_tmp[267];
        cube[274] = cube_tmp[266];
        cube[275] = cube_tmp[265];
        cube[276] = cube_tmp[264];
        cube[277] = cube_tmp[263];
        cube[278] = cube_tmp[262];
        cube[279] = cube_tmp[261];
        cube[280] = cube_tmp[260];
        cube[281] = cube_tmp[259];
        cube[282] = cube_tmp[258];
        cube[283] = cube_tmp[257];
        cube[284] = cube_tmp[256];
        cube[285] = cube_tmp[255];
        cube[286] = cube_tmp[254];
        cube[287] = cube_tmp[253];
        cube[288] = cube_tmp[252];
        cube[289] = cube_tmp[251];
        cube[290] = cube_tmp[250];
        cube[291] = cube_tmp[249];
        cube[292] = cube_tmp[248];
        cube[293] = cube_tmp[247];
        cube[294] = cube_tmp[246];
        break;

    case Dw:
        cube[85] = cube_tmp[232];
        cube[86] = cube_tmp[233];
        cube[87] = cube_tmp[234];
        cube[88] = cube_tmp[235];
        cube[89] = cube_tmp[236];
        cube[90] = cube_tmp[237];
        cube[91] = cube_tmp[238];
        cube[92] = cube_tmp[239];
        cube[93] = cube_tmp[240];
        cube[94] = cube_tmp[241];
        cube[95] = cube_tmp[242];
        cube[96] = cube_tmp[243];
        cube[97] = cube_tmp[244];
        cube[98] = cube_tmp[245];
        cube[134] = cube_tmp[85];
        cube[135] = cube_tmp[86];
        cube[136] = cube_tmp[87];
        cube[137] = cube_tmp[88];
        cube[138] = cube_tmp[89];
        cube[139] = cube_tmp[90];
        cube[140] = cube_tmp[91];
        cube[141] = cube_tmp[92];
        cube[142] = cube_tmp[93];
        cube[143] = cube_tmp[94];
        cube[144] = cube_tmp[95];
        cube[145] = cube_tmp[96];
        cube[146] = cube_tmp[97];
        cube[147] = cube_tmp[98];
        cube[183] = cube_tmp[134];
        cube[184] = cube_tmp[135];
        cube[185] = cube_tmp[136];
        cube[186] = cube_tmp[137];
        cube[187] = cube_tmp[138];
        cube[188] = cube_tmp[139];
        cube[189] = cube_tmp[140];
        cube[190] = cube_tmp[141];
        cube[191] = cube_tmp[142];
        cube[192] = cube_tmp[143];
        cube[193] = cube_tmp[144];
        cube[194] = cube_tmp[145];
        cube[195] = cube_tmp[146];
        cube[196] = cube_tmp[147];
        cube[232] = cube_tmp[183];
        cube[233] = cube_tmp[184];
        cube[234] = cube_tmp[185];
        cube[235] = cube_tmp[186];
        cube[236] = cube_tmp[187];
        cube[237] = cube_tmp[188];
        cube[238] = cube_tmp[189];
        cube[239] = cube_tmp[190];
        cube[240] = cube_tmp[191];
        cube[241] = cube_tmp[192];
        cube[242] = cube_tmp[193];
        cube[243] = cube_tmp[194];
        cube[244] = cube_tmp[195];
        cube[245] = cube_tmp[196];
        cube[246] = cube_tmp[288];
        cube[247] = cube_tmp[281];
        cube[248] = cube_tmp[274];
        cube[249] = cube_tmp[267];
        cube[250] = cube_tmp[260];
        cube[251] = cube_tmp[253];
        cube[252] = cube_tmp[246];
        cube[253] = cube_tmp[289];
        cube[254] = cube_tmp[282];
        cube[255] = cube_tmp[275];
        cube[256] = cube_tmp[268];
        cube[257] = cube_tmp[261];
        cube[258] = cube_tmp[254];
        cube[259] = cube_tmp[247];
        cube[260] = cube_tmp[290];
        cube[261] = cube_tmp[283];
        cube[262] = cube_tmp[276];
        cube[263] = cube_tmp[269];
        cube[264] = cube_tmp[262];
        cube[265] = cube_tmp[255];
        cube[266] = cube_tmp[248];
        cube[267] = cube_tmp[291];
        cube[268] = cube_tmp[284];
        cube[269] = cube_tmp[277];
        cube[271] = cube_tmp[263];
        cube[272] = cube_tmp[256];
        cube[273] = cube_tmp[249];
        cube[274] = cube_tmp[292];
        cube[275] = cube_tmp[285];
        cube[276] = cube_tmp[278];
        cube[277] = cube_tmp[271];
        cube[278] = cube_tmp[264];
        cube[279] = cube_tmp[257];
        cube[280] = cube_tmp[250];
        cube[281] = cube_tmp[293];
        cube[282] = cube_tmp[286];
        cube[283] = cube_tmp[279];
        cube[284] = cube_tmp[272];
        cube[285] = cube_tmp[265];
        cube[286] = cube_tmp[258];
        cube[287] = cube_tmp[251];
        cube[288] = cube_tmp[294];
        cube[289] = cube_tmp[287];
        cube[290] = cube_tmp[280];
        cube[291] = cube_tmp[273];
        cube[292] = cube_tmp[266];
        cube[293] = cube_tmp[259];
        cube[294] = cube_tmp[252];
        break;

    case Dw_PRIME:
        cube[85] = cube_tmp[134];
        cube[86] = cube_tmp[135];
        cube[87] = cube_tmp[136];
        cube[88] = cube_tmp[137];
        cube[89] = cube_tmp[138];
        cube[90] = cube_tmp[139];
        cube[91] = cube_tmp[140];
        cube[92] = cube_tmp[141];
        cube[93] = cube_tmp[142];
        cube[94] = cube_tmp[143];
        cube[95] = cube_tmp[144];
        cube[96] = cube_tmp[145];
        cube[97] = cube_tmp[146];
        cube[98] = cube_tmp[147];
        cube[134] = cube_tmp[183];
        cube[135] = cube_tmp[184];
        cube[136] = cube_tmp[185];
        cube[137] = cube_tmp[186];
        cube[138] = cube_tmp[187];
        cube[139] = cube_tmp[188];
        cube[140] = cube_tmp[189];
        cube[141] = cube_tmp[190];
        cube[142] = cube_tmp[191];
        cube[143] = cube_tmp[192];
        cube[144] = cube_tmp[193];
        cube[145] = cube_tmp[194];
        cube[146] = cube_tmp[195];
        cube[147] = cube_tmp[196];
        cube[183] = cube_tmp[232];
        cube[184] = cube_tmp[233];
        cube[185] = cube_tmp[234];
        cube[186] = cube_tmp[235];
        cube[187] = cube_tmp[236];
        cube[188] = cube_tmp[237];
        cube[189] = cube_tmp[238];
        cube[190] = cube_tmp[239];
        cube[191] = cube_tmp[240];
        cube[192] = cube_tmp[241];
        cube[193] = cube_tmp[242];
        cube[194] = cube_tmp[243];
        cube[195] = cube_tmp[244];
        cube[196] = cube_tmp[245];
        cube[232] = cube_tmp[85];
        cube[233] = cube_tmp[86];
        cube[234] = cube_tmp[87];
        cube[235] = cube_tmp[88];
        cube[236] = cube_tmp[89];
        cube[237] = cube_tmp[90];
        cube[238] = cube_tmp[91];
        cube[239] = cube_tmp[92];
        cube[240] = cube_tmp[93];
        cube[241] = cube_tmp[94];
        cube[242] = cube_tmp[95];
        cube[243] = cube_tmp[96];
        cube[244] = cube_tmp[97];
        cube[245] = cube_tmp[98];
        cube[246] = cube_tmp[252];
        cube[247] = cube_tmp[259];
        cube[248] = cube_tmp[266];
        cube[249] = cube_tmp[273];
        cube[250] = cube_tmp[280];
        cube[251] = cube_tmp[287];
        cube[252] = cube_tmp[294];
        cube[253] = cube_tmp[251];
        cube[254] = cube_tmp[258];
        cube[255] = cube_tmp[265];
        cube[256] = cube_tmp[272];
        cube[257] = cube_tmp[279];
        cube[258] = cube_tmp[286];
        cube[259] = cube_tmp[293];
        cube[260] = cube_tmp[250];
        cube[261] = cube_tmp[257];
        cube[262] = cube_tmp[264];
        cube[263] = cube_tmp[271];
        cube[264] = cube_tmp[278];
        cube[265] = cube_tmp[285];
        cube[266] = cube_tmp[292];
        cube[267] = cube_tmp[249];
        cube[268] = cube_tmp[256];
        cube[269] = cube_tmp[263];
        cube[271] = cube_tmp[277];
        cube[272] = cube_tmp[284];
        cube[273] = cube_tmp[291];
        cube[274] = cube_tmp[248];
        cube[275] = cube_tmp[255];
        cube[276] = cube_tmp[262];
        cube[277] = cube_tmp[269];
        cube[278] = cube_tmp[276];
        cube[279] = cube_tmp[283];
        cube[280] = cube_tmp[290];
        cube[281] = cube_tmp[247];
        cube[282] = cube_tmp[254];
        cube[283] = cube_tmp[261];
        cube[284] = cube_tmp[268];
        cube[285] = cube_tmp[275];
        cube[286] = cube_tmp[282];
        cube[287] = cube_tmp[289];
        cube[288] = cube_tmp[246];
        cube[289] = cube_tmp[253];
        cube[290] = cube_tmp[260];
        cube[291] = cube_tmp[267];
        cube[292] = cube_tmp[274];
        cube[293] = cube_tmp[281];
        cube[294] = cube_tmp[288];
        break;

    case Dw2:
        cube[85] = cube_tmp[183];
        cube[86] = cube_tmp[184];
        cube[87] = cube_tmp[185];
        cube[88] = cube_tmp[186];
        cube[89] = cube_tmp[187];
        cube[90] = cube_tmp[188];
        cube[91] = cube_tmp[189];
        cube[92] = cube_tmp[190];
        cube[93] = cube_tmp[191];
        cube[94] = cube_tmp[192];
        cube[95] = cube_tmp[193];
        cube[96] = cube_tmp[194];
        cube[97] = cube_tmp[195];
        cube[98] = cube_tmp[196];
        cube[134] = cube_tmp[232];
        cube[135] = cube_tmp[233];
        cube[136] = cube_tmp[234];
        cube[137] = cube_tmp[235];
        cube[138] = cube_tmp[236];
        cube[139] = cube_tmp[237];
        cube[140] = cube_tmp[238];
        cube[141] = cube_tmp[239];
        cube[142] = cube_tmp[240];
        cube[143] = cube_tmp[241];
        cube[144] = cube_tmp[242];
        cube[145] = cube_tmp[243];
        cube[146] = cube_tmp[244];
        cube[147] = cube_tmp[245];
        cube[183] = cube_tmp[85];
        cube[184] = cube_tmp[86];
        cube[185] = cube_tmp[87];
        cube[186] = cube_tmp[88];
        cube[187] = cube_tmp[89];
        cube[188] = cube_tmp[90];
        cube[189] = cube_tmp[91];
        cube[190] = cube_tmp[92];
        cube[191] = cube_tmp[93];
        cube[192] = cube_tmp[94];
        cube[193] = cube_tmp[95];
        cube[194] = cube_tmp[96];
        cube[195] = cube_tmp[97];
        cube[196] = cube_tmp[98];
        cube[232] = cube_tmp[134];
        cube[233] = cube_tmp[135];
        cube[234] = cube_tmp[136];
        cube[235] = cube_tmp[137];
        cube[236] = cube_tmp[138];
        cube[237] = cube_tmp[139];
        cube[238] = cube_tmp[140];
        cube[239] = cube_tmp[141];
        cube[240] = cube_tmp[142];
        cube[241] = cube_tmp[143];
        cube[242] = cube_tmp[144];
        cube[243] = cube_tmp[145];
        cube[244] = cube_tmp[146];
        cube[245] = cube_tmp[147];
        cube[246] = cube_tmp[294];
        cube[247] = cube_tmp[293];
        cube[248] = cube_tmp[292];
        cube[249] = cube_tmp[291];
        cube[250] = cube_tmp[290];
        cube[251] = cube_tmp[289];
        cube[252] = cube_tmp[288];
        cube[253] = cube_tmp[287];
        cube[254] = cube_tmp[286];
        cube[255] = cube_tmp[285];
        cube[256] = cube_tmp[284];
        cube[257] = cube_tmp[283];
        cube[258] = cube_tmp[282];
        cube[259] = cube_tmp[281];
        cube[260] = cube_tmp[280];
        cube[261] = cube_tmp[279];
        cube[262] = cube_tmp[278];
        cube[263] = cube_tmp[277];
        cube[264] = cube_tmp[276];
        cube[265] = cube_tmp[275];
        cube[266] = cube_tmp[274];
        cube[267] = cube_tmp[273];
        cube[268] = cube_tmp[272];
        cube[269] = cube_tmp[271];
        cube[271] = cube_tmp[269];
        cube[272] = cube_tmp[268];
        cube[273] = cube_tmp[267];
        cube[274] = cube_tmp[266];
        cube[275] = cube_tmp[265];
        cube[276] = cube_tmp[264];
        cube[277] = cube_tmp[263];
        cube[278] = cube_tmp[262];
        cube[279] = cube_tmp[261];
        cube[280] = cube_tmp[260];
        cube[281] = cube_tmp[259];
        cube[282] = cube_tmp[258];
        cube[283] = cube_tmp[257];
        cube[284] = cube_tmp[256];
        cube[285] = cube_tmp[255];
        cube[286] = cube_tmp[254];
        cube[287] = cube_tmp[253];
        cube[288] = cube_tmp[252];
        cube[289] = cube_tmp[251];
        cube[290] = cube_tmp[250];
        cube[291] = cube_tmp[249];
        cube[292] = cube_tmp[248];
        cube[293] = cube_tmp[247];
        cube[294] = cube_tmp[246];
        break;

    case threeDw:
        cube[78] = cube_tmp[225];
        cube[79] = cube_tmp[226];
        cube[80] = cube_tmp[227];
        cube[81] = cube_tmp[228];
        cube[82] = cube_tmp[229];
        cube[83] = cube_tmp[230];
        cube[84] = cube_tmp[231];
        cube[85] = cube_tmp[232];
        cube[86] = cube_tmp[233];
        cube[87] = cube_tmp[234];
        cube[88] = cube_tmp[235];
        cube[89] = cube_tmp[236];
        cube[90] = cube_tmp[237];
        cube[91] = cube_tmp[238];
        cube[92] = cube_tmp[239];
        cube[93] = cube_tmp[240];
        cube[94] = cube_tmp[241];
        cube[95] = cube_tmp[242];
        cube[96] = cube_tmp[243];
        cube[97] = cube_tmp[244];
        cube[98] = cube_tmp[245];
        cube[127] = cube_tmp[78];
        cube[128] = cube_tmp[79];
        cube[129] = cube_tmp[80];
        cube[130] = cube_tmp[81];
        cube[131] = cube_tmp[82];
        cube[132] = cube_tmp[83];
        cube[133] = cube_tmp[84];
        cube[134] = cube_tmp[85];
        cube[135] = cube_tmp[86];
        cube[136] = cube_tmp[87];
        cube[137] = cube_tmp[88];
        cube[138] = cube_tmp[89];
        cube[139] = cube_tmp[90];
        cube[140] = cube_tmp[91];
        cube[141] = cube_tmp[92];
        cube[142] = cube_tmp[93];
        cube[143] = cube_tmp[94];
        cube[144] = cube_tmp[95];
        cube[145] = cube_tmp[96];
        cube[146] = cube_tmp[97];
        cube[147] = cube_tmp[98];
        cube[176] = cube_tmp[127];
        cube[177] = cube_tmp[128];
        cube[178] = cube_tmp[129];
        cube[179] = cube_tmp[130];
        cube[180] = cube_tmp[131];
        cube[181] = cube_tmp[132];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[134];
        cube[184] = cube_tmp[135];
        cube[185] = cube_tmp[136];
        cube[186] = cube_tmp[137];
        cube[187] = cube_tmp[138];
        cube[188] = cube_tmp[139];
        cube[189] = cube_tmp[140];
        cube[190] = cube_tmp[141];
        cube[191] = cube_tmp[142];
        cube[192] = cube_tmp[143];
        cube[193] = cube_tmp[144];
        cube[194] = cube_tmp[145];
        cube[195] = cube_tmp[146];
        cube[196] = cube_tmp[147];
        cube[225] = cube_tmp[176];
        cube[226] = cube_tmp[177];
        cube[227] = cube_tmp[178];
        cube[228] = cube_tmp[179];
        cube[229] = cube_tmp[180];
        cube[230] = cube_tmp[181];
        cube[231] = cube_tmp[182];
        cube[232] = cube_tmp[183];
        cube[233] = cube_tmp[184];
        cube[234] = cube_tmp[185];
        cube[235] = cube_tmp[186];
        cube[236] = cube_tmp[187];
        cube[237] = cube_tmp[188];
        cube[238] = cube_tmp[189];
        cube[239] = cube_tmp[190];
        cube[240] = cube_tmp[191];
        cube[241] = cube_tmp[192];
        cube[242] = cube_tmp[193];
        cube[243] = cube_tmp[194];
        cube[244] = cube_tmp[195];
        cube[245] = cube_tmp[196];
        cube[246] = cube_tmp[288];
        cube[247] = cube_tmp[281];
        cube[248] = cube_tmp[274];
        cube[249] = cube_tmp[267];
        cube[250] = cube_tmp[260];
        cube[251] = cube_tmp[253];
        cube[252] = cube_tmp[246];
        cube[253] = cube_tmp[289];
        cube[254] = cube_tmp[282];
        cube[255] = cube_tmp[275];
        cube[256] = cube_tmp[268];
        cube[257] = cube_tmp[261];
        cube[258] = cube_tmp[254];
        cube[259] = cube_tmp[247];
        cube[260] = cube_tmp[290];
        cube[261] = cube_tmp[283];
        cube[262] = cube_tmp[276];
        cube[263] = cube_tmp[269];
        cube[264] = cube_tmp[262];
        cube[265] = cube_tmp[255];
        cube[266] = cube_tmp[248];
        cube[267] = cube_tmp[291];
        cube[268] = cube_tmp[284];
        cube[269] = cube_tmp[277];
        cube[271] = cube_tmp[263];
        cube[272] = cube_tmp[256];
        cube[273] = cube_tmp[249];
        cube[274] = cube_tmp[292];
        cube[275] = cube_tmp[285];
        cube[276] = cube_tmp[278];
        cube[277] = cube_tmp[271];
        cube[278] = cube_tmp[264];
        cube[279] = cube_tmp[257];
        cube[280] = cube_tmp[250];
        cube[281] = cube_tmp[293];
        cube[282] = cube_tmp[286];
        cube[283] = cube_tmp[279];
        cube[284] = cube_tmp[272];
        cube[285] = cube_tmp[265];
        cube[286] = cube_tmp[258];
        cube[287] = cube_tmp[251];
        cube[288] = cube_tmp[294];
        cube[289] = cube_tmp[287];
        cube[290] = cube_tmp[280];
        cube[291] = cube_tmp[273];
        cube[292] = cube_tmp[266];
        cube[293] = cube_tmp[259];
        cube[294] = cube_tmp[252];
        break;

    case threeDw_PRIME:
        cube[78] = cube_tmp[127];
        cube[79] = cube_tmp[128];
        cube[80] = cube_tmp[129];
        cube[81] = cube_tmp[130];
        cube[82] = cube_tmp[131];
        cube[83] = cube_tmp[132];
        cube[84] = cube_tmp[133];
        cube[85] = cube_tmp[134];
        cube[86] = cube_tmp[135];
        cube[87] = cube_tmp[136];
        cube[88] = cube_tmp[137];
        cube[89] = cube_tmp[138];
        cube[90] = cube_tmp[139];
        cube[91] = cube_tmp[140];
        cube[92] = cube_tmp[141];
        cube[93] = cube_tmp[142];
        cube[94] = cube_tmp[143];
        cube[95] = cube_tmp[144];
        cube[96] = cube_tmp[145];
        cube[97] = cube_tmp[146];
        cube[98] = cube_tmp[147];
        cube[127] = cube_tmp[176];
        cube[128] = cube_tmp[177];
        cube[129] = cube_tmp[178];
        cube[130] = cube_tmp[179];
        cube[131] = cube_tmp[180];
        cube[132] = cube_tmp[181];
        cube[133] = cube_tmp[182];
        cube[134] = cube_tmp[183];
        cube[135] = cube_tmp[184];
        cube[136] = cube_tmp[185];
        cube[137] = cube_tmp[186];
        cube[138] = cube_tmp[187];
        cube[139] = cube_tmp[188];
        cube[140] = cube_tmp[189];
        cube[141] = cube_tmp[190];
        cube[142] = cube_tmp[191];
        cube[143] = cube_tmp[192];
        cube[144] = cube_tmp[193];
        cube[145] = cube_tmp[194];
        cube[146] = cube_tmp[195];
        cube[147] = cube_tmp[196];
        cube[176] = cube_tmp[225];
        cube[177] = cube_tmp[226];
        cube[178] = cube_tmp[227];
        cube[179] = cube_tmp[228];
        cube[180] = cube_tmp[229];
        cube[181] = cube_tmp[230];
        cube[182] = cube_tmp[231];
        cube[183] = cube_tmp[232];
        cube[184] = cube_tmp[233];
        cube[185] = cube_tmp[234];
        cube[186] = cube_tmp[235];
        cube[187] = cube_tmp[236];
        cube[188] = cube_tmp[237];
        cube[189] = cube_tmp[238];
        cube[190] = cube_tmp[239];
        cube[191] = cube_tmp[240];
        cube[192] = cube_tmp[241];
        cube[193] = cube_tmp[242];
        cube[194] = cube_tmp[243];
        cube[195] = cube_tmp[244];
        cube[196] = cube_tmp[245];
        cube[225] = cube_tmp[78];
        cube[226] = cube_tmp[79];
        cube[227] = cube_tmp[80];
        cube[228] = cube_tmp[81];
        cube[229] = cube_tmp[82];
        cube[230] = cube_tmp[83];
        cube[231] = cube_tmp[84];
        cube[232] = cube_tmp[85];
        cube[233] = cube_tmp[86];
        cube[234] = cube_tmp[87];
        cube[235] = cube_tmp[88];
        cube[236] = cube_tmp[89];
        cube[237] = cube_tmp[90];
        cube[238] = cube_tmp[91];
        cube[239] = cube_tmp[92];
        cube[240] = cube_tmp[93];
        cube[241] = cube_tmp[94];
        cube[242] = cube_tmp[95];
        cube[243] = cube_tmp[96];
        cube[244] = cube_tmp[97];
        cube[245] = cube_tmp[98];
        cube[246] = cube_tmp[252];
        cube[247] = cube_tmp[259];
        cube[248] = cube_tmp[266];
        cube[249] = cube_tmp[273];
        cube[250] = cube_tmp[280];
        cube[251] = cube_tmp[287];
        cube[252] = cube_tmp[294];
        cube[253] = cube_tmp[251];
        cube[254] = cube_tmp[258];
        cube[255] = cube_tmp[265];
        cube[256] = cube_tmp[272];
        cube[257] = cube_tmp[279];
        cube[258] = cube_tmp[286];
        cube[259] = cube_tmp[293];
        cube[260] = cube_tmp[250];
        cube[261] = cube_tmp[257];
        cube[262] = cube_tmp[264];
        cube[263] = cube_tmp[271];
        cube[264] = cube_tmp[278];
        cube[265] = cube_tmp[285];
        cube[266] = cube_tmp[292];
        cube[267] = cube_tmp[249];
        cube[268] = cube_tmp[256];
        cube[269] = cube_tmp[263];
        cube[271] = cube_tmp[277];
        cube[272] = cube_tmp[284];
        cube[273] = cube_tmp[291];
        cube[274] = cube_tmp[248];
        cube[275] = cube_tmp[255];
        cube[276] = cube_tmp[262];
        cube[277] = cube_tmp[269];
        cube[278] = cube_tmp[276];
        cube[279] = cube_tmp[283];
        cube[280] = cube_tmp[290];
        cube[281] = cube_tmp[247];
        cube[282] = cube_tmp[254];
        cube[283] = cube_tmp[261];
        cube[284] = cube_tmp[268];
        cube[285] = cube_tmp[275];
        cube[286] = cube_tmp[282];
        cube[287] = cube_tmp[289];
        cube[288] = cube_tmp[246];
        cube[289] = cube_tmp[253];
        cube[290] = cube_tmp[260];
        cube[291] = cube_tmp[267];
        cube[292] = cube_tmp[274];
        cube[293] = cube_tmp[281];
        cube[294] = cube_tmp[288];
        break;

    case threeDw2:
        cube[78] = cube_tmp[176];
        cube[79] = cube_tmp[177];
        cube[80] = cube_tmp[178];
        cube[81] = cube_tmp[179];
        cube[82] = cube_tmp[180];
        cube[83] = cube_tmp[181];
        cube[84] = cube_tmp[182];
        cube[85] = cube_tmp[183];
        cube[86] = cube_tmp[184];
        cube[87] = cube_tmp[185];
        cube[88] = cube_tmp[186];
        cube[89] = cube_tmp[187];
        cube[90] = cube_tmp[188];
        cube[91] = cube_tmp[189];
        cube[92] = cube_tmp[190];
        cube[93] = cube_tmp[191];
        cube[94] = cube_tmp[192];
        cube[95] = cube_tmp[193];
        cube[96] = cube_tmp[194];
        cube[97] = cube_tmp[195];
        cube[98] = cube_tmp[196];
        cube[127] = cube_tmp[225];
        cube[128] = cube_tmp[226];
        cube[129] = cube_tmp[227];
        cube[130] = cube_tmp[228];
        cube[131] = cube_tmp[229];
        cube[132] = cube_tmp[230];
        cube[133] = cube_tmp[231];
        cube[134] = cube_tmp[232];
        cube[135] = cube_tmp[233];
        cube[136] = cube_tmp[234];
        cube[137] = cube_tmp[235];
        cube[138] = cube_tmp[236];
        cube[139] = cube_tmp[237];
        cube[140] = cube_tmp[238];
        cube[141] = cube_tmp[239];
        cube[142] = cube_tmp[240];
        cube[143] = cube_tmp[241];
        cube[144] = cube_tmp[242];
        cube[145] = cube_tmp[243];
        cube[146] = cube_tmp[244];
        cube[147] = cube_tmp[245];
        cube[176] = cube_tmp[78];
        cube[177] = cube_tmp[79];
        cube[178] = cube_tmp[80];
        cube[179] = cube_tmp[81];
        cube[180] = cube_tmp[82];
        cube[181] = cube_tmp[83];
        cube[182] = cube_tmp[84];
        cube[183] = cube_tmp[85];
        cube[184] = cube_tmp[86];
        cube[185] = cube_tmp[87];
        cube[186] = cube_tmp[88];
        cube[187] = cube_tmp[89];
        cube[188] = cube_tmp[90];
        cube[189] = cube_tmp[91];
        cube[190] = cube_tmp[92];
        cube[191] = cube_tmp[93];
        cube[192] = cube_tmp[94];
        cube[193] = cube_tmp[95];
        cube[194] = cube_tmp[96];
        cube[195] = cube_tmp[97];
        cube[196] = cube_tmp[98];
        cube[225] = cube_tmp[127];
        cube[226] = cube_tmp[128];
        cube[227] = cube_tmp[129];
        cube[228] = cube_tmp[130];
        cube[229] = cube_tmp[131];
        cube[230] = cube_tmp[132];
        cube[231] = cube_tmp[133];
        cube[232] = cube_tmp[134];
        cube[233] = cube_tmp[135];
        cube[234] = cube_tmp[136];
        cube[235] = cube_tmp[137];
        cube[236] = cube_tmp[138];
        cube[237] = cube_tmp[139];
        cube[238] = cube_tmp[140];
        cube[239] = cube_tmp[141];
        cube[240] = cube_tmp[142];
        cube[241] = cube_tmp[143];
        cube[242] = cube_tmp[144];
        cube[243] = cube_tmp[145];
        cube[244] = cube_tmp[146];
        cube[245] = cube_tmp[147];
        cube[246] = cube_tmp[294];
        cube[247] = cube_tmp[293];
        cube[248] = cube_tmp[292];
        cube[249] = cube_tmp[291];
        cube[250] = cube_tmp[290];
        cube[251] = cube_tmp[289];
        cube[252] = cube_tmp[288];
        cube[253] = cube_tmp[287];
        cube[254] = cube_tmp[286];
        cube[255] = cube_tmp[285];
        cube[256] = cube_tmp[284];
        cube[257] = cube_tmp[283];
        cube[258] = cube_tmp[282];
        cube[259] = cube_tmp[281];
        cube[260] = cube_tmp[280];
        cube[261] = cube_tmp[279];
        cube[262] = cube_tmp[278];
        cube[263] = cube_tmp[277];
        cube[264] = cube_tmp[276];
        cube[265] = cube_tmp[275];
        cube[266] = cube_tmp[274];
        cube[267] = cube_tmp[273];
        cube[268] = cube_tmp[272];
        cube[269] = cube_tmp[271];
        cube[271] = cube_tmp[269];
        cube[272] = cube_tmp[268];
        cube[273] = cube_tmp[267];
        cube[274] = cube_tmp[266];
        cube[275] = cube_tmp[265];
        cube[276] = cube_tmp[264];
        cube[277] = cube_tmp[263];
        cube[278] = cube_tmp[262];
        cube[279] = cube_tmp[261];
        cube[280] = cube_tmp[260];
        cube[281] = cube_tmp[259];
        cube[282] = cube_tmp[258];
        cube[283] = cube_tmp[257];
        cube[284] = cube_tmp[256];
        cube[285] = cube_tmp[255];
        cube[286] = cube_tmp[254];
        cube[287] = cube_tmp[253];
        cube[288] = cube_tmp[252];
        cube[289] = cube_tmp[251];
        cube[290] = cube_tmp[250];
        cube[291] = cube_tmp[249];
        cube[292] = cube_tmp[248];
        cube[293] = cube_tmp[247];
        cube[294] = cube_tmp[246];
        break;

    case X:
        cube[1] = cube_tmp[99];
        cube[2] = cube_tmp[100];
        cube[3] = cube_tmp[101];
        cube[4] = cube_tmp[102];
        cube[5] = cube_tmp[103];
        cube[6] = cube_tmp[104];
        cube[7] = cube_tmp[105];
        cube[8] = cube_tmp[106];
        cube[9] = cube_tmp[107];
        cube[10] = cube_tmp[108];
        cube[11] = cube_tmp[109];
        cube[12] = cube_tmp[110];
        cube[13] = cube_tmp[111];
        cube[14] = cube_tmp[112];
        cube[15] = cube_tmp[113];
        cube[16] = cube_tmp[114];
        cube[17] = cube_tmp[115];
        cube[18] = cube_tmp[116];
        cube[19] = cube_tmp[117];
        cube[20] = cube_tmp[118];
        cube[21] = cube_tmp[119];
        cube[22] = cube_tmp[120];
        cube[23] = cube_tmp[121];
        cube[24] = cube_tmp[122];
        cube[25] = cube_tmp[123];
        cube[26] = cube_tmp[124];
        cube[27] = cube_tmp[125];
        cube[28] = cube_tmp[126];
        cube[29] = cube_tmp[127];
        cube[30] = cube_tmp[128];
        cube[31] = cube_tmp[129];
        cube[32] = cube_tmp[130];
        cube[33] = cube_tmp[131];
        cube[34] = cube_tmp[132];
        cube[35] = cube_tmp[133];
        cube[36] = cube_tmp[134];
        cube[37] = cube_tmp[135];
        cube[38] = cube_tmp[136];
        cube[39] = cube_tmp[137];
        cube[40] = cube_tmp[138];
        cube[41] = cube_tmp[139];
        cube[42] = cube_tmp[140];
        cube[43] = cube_tmp[141];
        cube[44] = cube_tmp[142];
        cube[45] = cube_tmp[143];
        cube[46] = cube_tmp[144];
        cube[47] = cube_tmp[145];
        cube[48] = cube_tmp[146];
        cube[49] = cube_tmp[147];
        cube[50] = cube_tmp[56];
        cube[51] = cube_tmp[63];
        cube[52] = cube_tmp[70];
        cube[53] = cube_tmp[77];
        cube[54] = cube_tmp[84];
        cube[55] = cube_tmp[91];
        cube[56] = cube_tmp[98];
        cube[57] = cube_tmp[55];
        cube[58] = cube_tmp[62];
        cube[59] = cube_tmp[69];
        cube[60] = cube_tmp[76];
        cube[61] = cube_tmp[83];
        cube[62] = cube_tmp[90];
        cube[63] = cube_tmp[97];
        cube[64] = cube_tmp[54];
        cube[65] = cube_tmp[61];
        cube[66] = cube_tmp[68];
        cube[67] = cube_tmp[75];
        cube[68] = cube_tmp[82];
        cube[69] = cube_tmp[89];
        cube[70] = cube_tmp[96];
        cube[71] = cube_tmp[53];
        cube[72] = cube_tmp[60];
        cube[73] = cube_tmp[67];
        cube[75] = cube_tmp[81];
        cube[76] = cube_tmp[88];
        cube[77] = cube_tmp[95];
        cube[78] = cube_tmp[52];
        cube[79] = cube_tmp[59];
        cube[80] = cube_tmp[66];
        cube[81] = cube_tmp[73];
        cube[82] = cube_tmp[80];
        cube[83] = cube_tmp[87];
        cube[84] = cube_tmp[94];
        cube[85] = cube_tmp[51];
        cube[86] = cube_tmp[58];
        cube[87] = cube_tmp[65];
        cube[88] = cube_tmp[72];
        cube[89] = cube_tmp[79];
        cube[90] = cube_tmp[86];
        cube[91] = cube_tmp[93];
        cube[92] = cube_tmp[50];
        cube[93] = cube_tmp[57];
        cube[94] = cube_tmp[64];
        cube[95] = cube_tmp[71];
        cube[96] = cube_tmp[78];
        cube[97] = cube_tmp[85];
        cube[98] = cube_tmp[92];
        cube[99] = cube_tmp[246];
        cube[100] = cube_tmp[247];
        cube[101] = cube_tmp[248];
        cube[102] = cube_tmp[249];
        cube[103] = cube_tmp[250];
        cube[104] = cube_tmp[251];
        cube[105] = cube_tmp[252];
        cube[106] = cube_tmp[253];
        cube[107] = cube_tmp[254];
        cube[108] = cube_tmp[255];
        cube[109] = cube_tmp[256];
        cube[110] = cube_tmp[257];
        cube[111] = cube_tmp[258];
        cube[112] = cube_tmp[259];
        cube[113] = cube_tmp[260];
        cube[114] = cube_tmp[261];
        cube[115] = cube_tmp[262];
        cube[116] = cube_tmp[263];
        cube[117] = cube_tmp[264];
        cube[118] = cube_tmp[265];
        cube[119] = cube_tmp[266];
        cube[120] = cube_tmp[267];
        cube[121] = cube_tmp[268];
        cube[122] = cube_tmp[269];
        cube[123] = cube_tmp[270];
        cube[124] = cube_tmp[271];
        cube[125] = cube_tmp[272];
        cube[126] = cube_tmp[273];
        cube[127] = cube_tmp[274];
        cube[128] = cube_tmp[275];
        cube[129] = cube_tmp[276];
        cube[130] = cube_tmp[277];
        cube[131] = cube_tmp[278];
        cube[132] = cube_tmp[279];
        cube[133] = cube_tmp[280];
        cube[134] = cube_tmp[281];
        cube[135] = cube_tmp[282];
        cube[136] = cube_tmp[283];
        cube[137] = cube_tmp[284];
        cube[138] = cube_tmp[285];
        cube[139] = cube_tmp[286];
        cube[140] = cube_tmp[287];
        cube[141] = cube_tmp[288];
        cube[142] = cube_tmp[289];
        cube[143] = cube_tmp[290];
        cube[144] = cube_tmp[291];
        cube[145] = cube_tmp[292];
        cube[146] = cube_tmp[293];
        cube[147] = cube_tmp[294];
        cube[148] = cube_tmp[190];
        cube[149] = cube_tmp[183];
        cube[150] = cube_tmp[176];
        cube[151] = cube_tmp[169];
        cube[152] = cube_tmp[162];
        cube[153] = cube_tmp[155];
        cube[154] = cube_tmp[148];
        cube[155] = cube_tmp[191];
        cube[156] = cube_tmp[184];
        cube[157] = cube_tmp[177];
        cube[158] = cube_tmp[170];
        cube[159] = cube_tmp[163];
        cube[160] = cube_tmp[156];
        cube[161] = cube_tmp[149];
        cube[162] = cube_tmp[192];
        cube[163] = cube_tmp[185];
        cube[164] = cube_tmp[178];
        cube[165] = cube_tmp[171];
        cube[166] = cube_tmp[164];
        cube[167] = cube_tmp[157];
        cube[168] = cube_tmp[150];
        cube[169] = cube_tmp[193];
        cube[170] = cube_tmp[186];
        cube[171] = cube_tmp[179];
        cube[173] = cube_tmp[165];
        cube[174] = cube_tmp[158];
        cube[175] = cube_tmp[151];
        cube[176] = cube_tmp[194];
        cube[177] = cube_tmp[187];
        cube[178] = cube_tmp[180];
        cube[179] = cube_tmp[173];
        cube[180] = cube_tmp[166];
        cube[181] = cube_tmp[159];
        cube[182] = cube_tmp[152];
        cube[183] = cube_tmp[195];
        cube[184] = cube_tmp[188];
        cube[185] = cube_tmp[181];
        cube[186] = cube_tmp[174];
        cube[187] = cube_tmp[167];
        cube[188] = cube_tmp[160];
        cube[189] = cube_tmp[153];
        cube[190] = cube_tmp[196];
        cube[191] = cube_tmp[189];
        cube[192] = cube_tmp[182];
        cube[193] = cube_tmp[175];
        cube[194] = cube_tmp[168];
        cube[195] = cube_tmp[161];
        cube[196] = cube_tmp[154];
        cube[197] = cube_tmp[49];
        cube[198] = cube_tmp[48];
        cube[199] = cube_tmp[47];
        cube[200] = cube_tmp[46];
        cube[201] = cube_tmp[45];
        cube[202] = cube_tmp[44];
        cube[203] = cube_tmp[43];
        cube[204] = cube_tmp[42];
        cube[205] = cube_tmp[41];
        cube[206] = cube_tmp[40];
        cube[207] = cube_tmp[39];
        cube[208] = cube_tmp[38];
        cube[209] = cube_tmp[37];
        cube[210] = cube_tmp[36];
        cube[211] = cube_tmp[35];
        cube[212] = cube_tmp[34];
        cube[213] = cube_tmp[33];
        cube[214] = cube_tmp[32];
        cube[215] = cube_tmp[31];
        cube[216] = cube_tmp[30];
        cube[217] = cube_tmp[29];
        cube[218] = cube_tmp[28];
        cube[219] = cube_tmp[27];
        cube[220] = cube_tmp[26];
        cube[221] = cube_tmp[25];
        cube[222] = cube_tmp[24];
        cube[223] = cube_tmp[23];
        cube[224] = cube_tmp[22];
        cube[225] = cube_tmp[21];
        cube[226] = cube_tmp[20];
        cube[227] = cube_tmp[19];
        cube[228] = cube_tmp[18];
        cube[229] = cube_tmp[17];
        cube[230] = cube_tmp[16];
        cube[231] = cube_tmp[15];
        cube[232] = cube_tmp[14];
        cube[233] = cube_tmp[13];
        cube[234] = cube_tmp[12];
        cube[235] = cube_tmp[11];
        cube[236] = cube_tmp[10];
        cube[237] = cube_tmp[9];
        cube[238] = cube_tmp[8];
        cube[239] = cube_tmp[7];
        cube[240] = cube_tmp[6];
        cube[241] = cube_tmp[5];
        cube[242] = cube_tmp[4];
        cube[243] = cube_tmp[3];
        cube[244] = cube_tmp[2];
        cube[245] = cube_tmp[1];
        cube[246] = cube_tmp[245];
        cube[247] = cube_tmp[244];
        cube[248] = cube_tmp[243];
        cube[249] = cube_tmp[242];
        cube[250] = cube_tmp[241];
        cube[251] = cube_tmp[240];
        cube[252] = cube_tmp[239];
        cube[253] = cube_tmp[238];
        cube[254] = cube_tmp[237];
        cube[255] = cube_tmp[236];
        cube[256] = cube_tmp[235];
        cube[257] = cube_tmp[234];
        cube[258] = cube_tmp[233];
        cube[259] = cube_tmp[232];
        cube[260] = cube_tmp[231];
        cube[261] = cube_tmp[230];
        cube[262] = cube_tmp[229];
        cube[263] = cube_tmp[228];
        cube[264] = cube_tmp[227];
        cube[265] = cube_tmp[226];
        cube[266] = cube_tmp[225];
        cube[267] = cube_tmp[224];
        cube[268] = cube_tmp[223];
        cube[269] = cube_tmp[222];
        cube[270] = cube_tmp[221];
        cube[271] = cube_tmp[220];
        cube[272] = cube_tmp[219];
        cube[273] = cube_tmp[218];
        cube[274] = cube_tmp[217];
        cube[275] = cube_tmp[216];
        cube[276] = cube_tmp[215];
        cube[277] = cube_tmp[214];
        cube[278] = cube_tmp[213];
        cube[279] = cube_tmp[212];
        cube[280] = cube_tmp[211];
        cube[281] = cube_tmp[210];
        cube[282] = cube_tmp[209];
        cube[283] = cube_tmp[208];
        cube[284] = cube_tmp[207];
        cube[285] = cube_tmp[206];
        cube[286] = cube_tmp[205];
        cube[287] = cube_tmp[204];
        cube[288] = cube_tmp[203];
        cube[289] = cube_tmp[202];
        cube[290] = cube_tmp[201];
        cube[291] = cube_tmp[200];
        cube[292] = cube_tmp[199];
        cube[293] = cube_tmp[198];
        cube[294] = cube_tmp[197];
        break;

    case X_PRIME:
        cube[1] = cube_tmp[245];
        cube[2] = cube_tmp[244];
        cube[3] = cube_tmp[243];
        cube[4] = cube_tmp[242];
        cube[5] = cube_tmp[241];
        cube[6] = cube_tmp[240];
        cube[7] = cube_tmp[239];
        cube[8] = cube_tmp[238];
        cube[9] = cube_tmp[237];
        cube[10] = cube_tmp[236];
        cube[11] = cube_tmp[235];
        cube[12] = cube_tmp[234];
        cube[13] = cube_tmp[233];
        cube[14] = cube_tmp[232];
        cube[15] = cube_tmp[231];
        cube[16] = cube_tmp[230];
        cube[17] = cube_tmp[229];
        cube[18] = cube_tmp[228];
        cube[19] = cube_tmp[227];
        cube[20] = cube_tmp[226];
        cube[21] = cube_tmp[225];
        cube[22] = cube_tmp[224];
        cube[23] = cube_tmp[223];
        cube[24] = cube_tmp[222];
        cube[25] = cube_tmp[221];
        cube[26] = cube_tmp[220];
        cube[27] = cube_tmp[219];
        cube[28] = cube_tmp[218];
        cube[29] = cube_tmp[217];
        cube[30] = cube_tmp[216];
        cube[31] = cube_tmp[215];
        cube[32] = cube_tmp[214];
        cube[33] = cube_tmp[213];
        cube[34] = cube_tmp[212];
        cube[35] = cube_tmp[211];
        cube[36] = cube_tmp[210];
        cube[37] = cube_tmp[209];
        cube[38] = cube_tmp[208];
        cube[39] = cube_tmp[207];
        cube[40] = cube_tmp[206];
        cube[41] = cube_tmp[205];
        cube[42] = cube_tmp[204];
        cube[43] = cube_tmp[203];
        cube[44] = cube_tmp[202];
        cube[45] = cube_tmp[201];
        cube[46] = cube_tmp[200];
        cube[47] = cube_tmp[199];
        cube[48] = cube_tmp[198];
        cube[49] = cube_tmp[197];
        cube[50] = cube_tmp[92];
        cube[51] = cube_tmp[85];
        cube[52] = cube_tmp[78];
        cube[53] = cube_tmp[71];
        cube[54] = cube_tmp[64];
        cube[55] = cube_tmp[57];
        cube[56] = cube_tmp[50];
        cube[57] = cube_tmp[93];
        cube[58] = cube_tmp[86];
        cube[59] = cube_tmp[79];
        cube[60] = cube_tmp[72];
        cube[61] = cube_tmp[65];
        cube[62] = cube_tmp[58];
        cube[63] = cube_tmp[51];
        cube[64] = cube_tmp[94];
        cube[65] = cube_tmp[87];
        cube[66] = cube_tmp[80];
        cube[67] = cube_tmp[73];
        cube[68] = cube_tmp[66];
        cube[69] = cube_tmp[59];
        cube[70] = cube_tmp[52];
        cube[71] = cube_tmp[95];
        cube[72] = cube_tmp[88];
        cube[73] = cube_tmp[81];
        cube[75] = cube_tmp[67];
        cube[76] = cube_tmp[60];
        cube[77] = cube_tmp[53];
        cube[78] = cube_tmp[96];
        cube[79] = cube_tmp[89];
        cube[80] = cube_tmp[82];
        cube[81] = cube_tmp[75];
        cube[82] = cube_tmp[68];
        cube[83] = cube_tmp[61];
        cube[84] = cube_tmp[54];
        cube[85] = cube_tmp[97];
        cube[86] = cube_tmp[90];
        cube[87] = cube_tmp[83];
        cube[88] = cube_tmp[76];
        cube[89] = cube_tmp[69];
        cube[90] = cube_tmp[62];
        cube[91] = cube_tmp[55];
        cube[92] = cube_tmp[98];
        cube[93] = cube_tmp[91];
        cube[94] = cube_tmp[84];
        cube[95] = cube_tmp[77];
        cube[96] = cube_tmp[70];
        cube[97] = cube_tmp[63];
        cube[98] = cube_tmp[56];
        cube[99] = cube_tmp[1];
        cube[100] = cube_tmp[2];
        cube[101] = cube_tmp[3];
        cube[102] = cube_tmp[4];
        cube[103] = cube_tmp[5];
        cube[104] = cube_tmp[6];
        cube[105] = cube_tmp[7];
        cube[106] = cube_tmp[8];
        cube[107] = cube_tmp[9];
        cube[108] = cube_tmp[10];
        cube[109] = cube_tmp[11];
        cube[110] = cube_tmp[12];
        cube[111] = cube_tmp[13];
        cube[112] = cube_tmp[14];
        cube[113] = cube_tmp[15];
        cube[114] = cube_tmp[16];
        cube[115] = cube_tmp[17];
        cube[116] = cube_tmp[18];
        cube[117] = cube_tmp[19];
        cube[118] = cube_tmp[20];
        cube[119] = cube_tmp[21];
        cube[120] = cube_tmp[22];
        cube[121] = cube_tmp[23];
        cube[122] = cube_tmp[24];
        cube[123] = cube_tmp[25];
        cube[124] = cube_tmp[26];
        cube[125] = cube_tmp[27];
        cube[126] = cube_tmp[28];
        cube[127] = cube_tmp[29];
        cube[128] = cube_tmp[30];
        cube[129] = cube_tmp[31];
        cube[130] = cube_tmp[32];
        cube[131] = cube_tmp[33];
        cube[132] = cube_tmp[34];
        cube[133] = cube_tmp[35];
        cube[134] = cube_tmp[36];
        cube[135] = cube_tmp[37];
        cube[136] = cube_tmp[38];
        cube[137] = cube_tmp[39];
        cube[138] = cube_tmp[40];
        cube[139] = cube_tmp[41];
        cube[140] = cube_tmp[42];
        cube[141] = cube_tmp[43];
        cube[142] = cube_tmp[44];
        cube[143] = cube_tmp[45];
        cube[144] = cube_tmp[46];
        cube[145] = cube_tmp[47];
        cube[146] = cube_tmp[48];
        cube[147] = cube_tmp[49];
        cube[148] = cube_tmp[154];
        cube[149] = cube_tmp[161];
        cube[150] = cube_tmp[168];
        cube[151] = cube_tmp[175];
        cube[152] = cube_tmp[182];
        cube[153] = cube_tmp[189];
        cube[154] = cube_tmp[196];
        cube[155] = cube_tmp[153];
        cube[156] = cube_tmp[160];
        cube[157] = cube_tmp[167];
        cube[158] = cube_tmp[174];
        cube[159] = cube_tmp[181];
        cube[160] = cube_tmp[188];
        cube[161] = cube_tmp[195];
        cube[162] = cube_tmp[152];
        cube[163] = cube_tmp[159];
        cube[164] = cube_tmp[166];
        cube[165] = cube_tmp[173];
        cube[166] = cube_tmp[180];
        cube[167] = cube_tmp[187];
        cube[168] = cube_tmp[194];
        cube[169] = cube_tmp[151];
        cube[170] = cube_tmp[158];
        cube[171] = cube_tmp[165];
        cube[173] = cube_tmp[179];
        cube[174] = cube_tmp[186];
        cube[175] = cube_tmp[193];
        cube[176] = cube_tmp[150];
        cube[177] = cube_tmp[157];
        cube[178] = cube_tmp[164];
        cube[179] = cube_tmp[171];
        cube[180] = cube_tmp[178];
        cube[181] = cube_tmp[185];
        cube[182] = cube_tmp[192];
        cube[183] = cube_tmp[149];
        cube[184] = cube_tmp[156];
        cube[185] = cube_tmp[163];
        cube[186] = cube_tmp[170];
        cube[187] = cube_tmp[177];
        cube[188] = cube_tmp[184];
        cube[189] = cube_tmp[191];
        cube[190] = cube_tmp[148];
        cube[191] = cube_tmp[155];
        cube[192] = cube_tmp[162];
        cube[193] = cube_tmp[169];
        cube[194] = cube_tmp[176];
        cube[195] = cube_tmp[183];
        cube[196] = cube_tmp[190];
        cube[197] = cube_tmp[294];
        cube[198] = cube_tmp[293];
        cube[199] = cube_tmp[292];
        cube[200] = cube_tmp[291];
        cube[201] = cube_tmp[290];
        cube[202] = cube_tmp[289];
        cube[203] = cube_tmp[288];
        cube[204] = cube_tmp[287];
        cube[205] = cube_tmp[286];
        cube[206] = cube_tmp[285];
        cube[207] = cube_tmp[284];
        cube[208] = cube_tmp[283];
        cube[209] = cube_tmp[282];
        cube[210] = cube_tmp[281];
        cube[211] = cube_tmp[280];
        cube[212] = cube_tmp[279];
        cube[213] = cube_tmp[278];
        cube[214] = cube_tmp[277];
        cube[215] = cube_tmp[276];
        cube[216] = cube_tmp[275];
        cube[217] = cube_tmp[274];
        cube[218] = cube_tmp[273];
        cube[219] = cube_tmp[272];
        cube[220] = cube_tmp[271];
        cube[221] = cube_tmp[270];
        cube[222] = cube_tmp[269];
        cube[223] = cube_tmp[268];
        cube[224] = cube_tmp[267];
        cube[225] = cube_tmp[266];
        cube[226] = cube_tmp[265];
        cube[227] = cube_tmp[264];
        cube[228] = cube_tmp[263];
        cube[229] = cube_tmp[262];
        cube[230] = cube_tmp[261];
        cube[231] = cube_tmp[260];
        cube[232] = cube_tmp[259];
        cube[233] = cube_tmp[258];
        cube[234] = cube_tmp[257];
        cube[235] = cube_tmp[256];
        cube[236] = cube_tmp[255];
        cube[237] = cube_tmp[254];
        cube[238] = cube_tmp[253];
        cube[239] = cube_tmp[252];
        cube[240] = cube_tmp[251];
        cube[241] = cube_tmp[250];
        cube[242] = cube_tmp[249];
        cube[243] = cube_tmp[248];
        cube[244] = cube_tmp[247];
        cube[245] = cube_tmp[246];
        cube[246] = cube_tmp[99];
        cube[247] = cube_tmp[100];
        cube[248] = cube_tmp[101];
        cube[249] = cube_tmp[102];
        cube[250] = cube_tmp[103];
        cube[251] = cube_tmp[104];
        cube[252] = cube_tmp[105];
        cube[253] = cube_tmp[106];
        cube[254] = cube_tmp[107];
        cube[255] = cube_tmp[108];
        cube[256] = cube_tmp[109];
        cube[257] = cube_tmp[110];
        cube[258] = cube_tmp[111];
        cube[259] = cube_tmp[112];
        cube[260] = cube_tmp[113];
        cube[261] = cube_tmp[114];
        cube[262] = cube_tmp[115];
        cube[263] = cube_tmp[116];
        cube[264] = cube_tmp[117];
        cube[265] = cube_tmp[118];
        cube[266] = cube_tmp[119];
        cube[267] = cube_tmp[120];
        cube[268] = cube_tmp[121];
        cube[269] = cube_tmp[122];
        cube[270] = cube_tmp[123];
        cube[271] = cube_tmp[124];
        cube[272] = cube_tmp[125];
        cube[273] = cube_tmp[126];
        cube[274] = cube_tmp[127];
        cube[275] = cube_tmp[128];
        cube[276] = cube_tmp[129];
        cube[277] = cube_tmp[130];
        cube[278] = cube_tmp[131];
        cube[279] = cube_tmp[132];
        cube[280] = cube_tmp[133];
        cube[281] = cube_tmp[134];
        cube[282] = cube_tmp[135];
        cube[283] = cube_tmp[136];
        cube[284] = cube_tmp[137];
        cube[285] = cube_tmp[138];
        cube[286] = cube_tmp[139];
        cube[287] = cube_tmp[140];
        cube[288] = cube_tmp[141];
        cube[289] = cube_tmp[142];
        cube[290] = cube_tmp[143];
        cube[291] = cube_tmp[144];
        cube[292] = cube_tmp[145];
        cube[293] = cube_tmp[146];
        cube[294] = cube_tmp[147];
        break;

    case Y:
        cube[1] = cube_tmp[43];
        cube[2] = cube_tmp[36];
        cube[3] = cube_tmp[29];
        cube[4] = cube_tmp[22];
        cube[5] = cube_tmp[15];
        cube[6] = cube_tmp[8];
        cube[7] = cube_tmp[1];
        cube[8] = cube_tmp[44];
        cube[9] = cube_tmp[37];
        cube[10] = cube_tmp[30];
        cube[11] = cube_tmp[23];
        cube[12] = cube_tmp[16];
        cube[13] = cube_tmp[9];
        cube[14] = cube_tmp[2];
        cube[15] = cube_tmp[45];
        cube[16] = cube_tmp[38];
        cube[17] = cube_tmp[31];
        cube[18] = cube_tmp[24];
        cube[19] = cube_tmp[17];
        cube[20] = cube_tmp[10];
        cube[21] = cube_tmp[3];
        cube[22] = cube_tmp[46];
        cube[23] = cube_tmp[39];
        cube[24] = cube_tmp[32];
        cube[26] = cube_tmp[18];
        cube[27] = cube_tmp[11];
        cube[28] = cube_tmp[4];
        cube[29] = cube_tmp[47];
        cube[30] = cube_tmp[40];
        cube[31] = cube_tmp[33];
        cube[32] = cube_tmp[26];
        cube[33] = cube_tmp[19];
        cube[34] = cube_tmp[12];
        cube[35] = cube_tmp[5];
        cube[36] = cube_tmp[48];
        cube[37] = cube_tmp[41];
        cube[38] = cube_tmp[34];
        cube[39] = cube_tmp[27];
        cube[40] = cube_tmp[20];
        cube[41] = cube_tmp[13];
        cube[42] = cube_tmp[6];
        cube[43] = cube_tmp[49];
        cube[44] = cube_tmp[42];
        cube[45] = cube_tmp[35];
        cube[46] = cube_tmp[28];
        cube[47] = cube_tmp[21];
        cube[48] = cube_tmp[14];
        cube[49] = cube_tmp[7];
        cube[50] = cube_tmp[99];
        cube[51] = cube_tmp[100];
        cube[52] = cube_tmp[101];
        cube[53] = cube_tmp[102];
        cube[54] = cube_tmp[103];
        cube[55] = cube_tmp[104];
        cube[56] = cube_tmp[105];
        cube[57] = cube_tmp[106];
        cube[58] = cube_tmp[107];
        cube[59] = cube_tmp[108];
        cube[60] = cube_tmp[109];
        cube[61] = cube_tmp[110];
        cube[62] = cube_tmp[111];
        cube[63] = cube_tmp[112];
        cube[64] = cube_tmp[113];
        cube[65] = cube_tmp[114];
        cube[66] = cube_tmp[115];
        cube[67] = cube_tmp[116];
        cube[68] = cube_tmp[117];
        cube[69] = cube_tmp[118];
        cube[70] = cube_tmp[119];
        cube[71] = cube_tmp[120];
        cube[72] = cube_tmp[121];
        cube[73] = cube_tmp[122];
        cube[74] = cube_tmp[123];
        cube[75] = cube_tmp[124];
        cube[76] = cube_tmp[125];
        cube[77] = cube_tmp[126];
        cube[78] = cube_tmp[127];
        cube[79] = cube_tmp[128];
        cube[80] = cube_tmp[129];
        cube[81] = cube_tmp[130];
        cube[82] = cube_tmp[131];
        cube[83] = cube_tmp[132];
        cube[84] = cube_tmp[133];
        cube[85] = cube_tmp[134];
        cube[86] = cube_tmp[135];
        cube[87] = cube_tmp[136];
        cube[88] = cube_tmp[137];
        cube[89] = cube_tmp[138];
        cube[90] = cube_tmp[139];
        cube[91] = cube_tmp[140];
        cube[92] = cube_tmp[141];
        cube[93] = cube_tmp[142];
        cube[94] = cube_tmp[143];
        cube[95] = cube_tmp[144];
        cube[96] = cube_tmp[145];
        cube[97] = cube_tmp[146];
        cube[98] = cube_tmp[147];
        cube[99] = cube_tmp[148];
        cube[100] = cube_tmp[149];
        cube[101] = cube_tmp[150];
        cube[102] = cube_tmp[151];
        cube[103] = cube_tmp[152];
        cube[104] = cube_tmp[153];
        cube[105] = cube_tmp[154];
        cube[106] = cube_tmp[155];
        cube[107] = cube_tmp[156];
        cube[108] = cube_tmp[157];
        cube[109] = cube_tmp[158];
        cube[110] = cube_tmp[159];
        cube[111] = cube_tmp[160];
        cube[112] = cube_tmp[161];
        cube[113] = cube_tmp[162];
        cube[114] = cube_tmp[163];
        cube[115] = cube_tmp[164];
        cube[116] = cube_tmp[165];
        cube[117] = cube_tmp[166];
        cube[118] = cube_tmp[167];
        cube[119] = cube_tmp[168];
        cube[120] = cube_tmp[169];
        cube[121] = cube_tmp[170];
        cube[122] = cube_tmp[171];
        cube[123] = cube_tmp[172];
        cube[124] = cube_tmp[173];
        cube[125] = cube_tmp[174];
        cube[126] = cube_tmp[175];
        cube[127] = cube_tmp[176];
        cube[128] = cube_tmp[177];
        cube[129] = cube_tmp[178];
        cube[130] = cube_tmp[179];
        cube[131] = cube_tmp[180];
        cube[132] = cube_tmp[181];
        cube[133] = cube_tmp[182];
        cube[134] = cube_tmp[183];
        cube[135] = cube_tmp[184];
        cube[136] = cube_tmp[185];
        cube[137] = cube_tmp[186];
        cube[138] = cube_tmp[187];
        cube[139] = cube_tmp[188];
        cube[140] = cube_tmp[189];
        cube[141] = cube_tmp[190];
        cube[142] = cube_tmp[191];
        cube[143] = cube_tmp[192];
        cube[144] = cube_tmp[193];
        cube[145] = cube_tmp[194];
        cube[146] = cube_tmp[195];
        cube[147] = cube_tmp[196];
        cube[148] = cube_tmp[197];
        cube[149] = cube_tmp[198];
        cube[150] = cube_tmp[199];
        cube[151] = cube_tmp[200];
        cube[152] = cube_tmp[201];
        cube[153] = cube_tmp[202];
        cube[154] = cube_tmp[203];
        cube[155] = cube_tmp[204];
        cube[156] = cube_tmp[205];
        cube[157] = cube_tmp[206];
        cube[158] = cube_tmp[207];
        cube[159] = cube_tmp[208];
        cube[160] = cube_tmp[209];
        cube[161] = cube_tmp[210];
        cube[162] = cube_tmp[211];
        cube[163] = cube_tmp[212];
        cube[164] = cube_tmp[213];
        cube[165] = cube_tmp[214];
        cube[166] = cube_tmp[215];
        cube[167] = cube_tmp[216];
        cube[168] = cube_tmp[217];
        cube[169] = cube_tmp[218];
        cube[170] = cube_tmp[219];
        cube[171] = cube_tmp[220];
        cube[172] = cube_tmp[221];
        cube[173] = cube_tmp[222];
        cube[174] = cube_tmp[223];
        cube[175] = cube_tmp[224];
        cube[176] = cube_tmp[225];
        cube[177] = cube_tmp[226];
        cube[178] = cube_tmp[227];
        cube[179] = cube_tmp[228];
        cube[180] = cube_tmp[229];
        cube[181] = cube_tmp[230];
        cube[182] = cube_tmp[231];
        cube[183] = cube_tmp[232];
        cube[184] = cube_tmp[233];
        cube[185] = cube_tmp[234];
        cube[186] = cube_tmp[235];
        cube[187] = cube_tmp[236];
        cube[188] = cube_tmp[237];
        cube[189] = cube_tmp[238];
        cube[190] = cube_tmp[239];
        cube[191] = cube_tmp[240];
        cube[192] = cube_tmp[241];
        cube[193] = cube_tmp[242];
        cube[194] = cube_tmp[243];
        cube[195] = cube_tmp[244];
        cube[196] = cube_tmp[245];
        cube[197] = cube_tmp[50];
        cube[198] = cube_tmp[51];
        cube[199] = cube_tmp[52];
        cube[200] = cube_tmp[53];
        cube[201] = cube_tmp[54];
        cube[202] = cube_tmp[55];
        cube[203] = cube_tmp[56];
        cube[204] = cube_tmp[57];
        cube[205] = cube_tmp[58];
        cube[206] = cube_tmp[59];
        cube[207] = cube_tmp[60];
        cube[208] = cube_tmp[61];
        cube[209] = cube_tmp[62];
        cube[210] = cube_tmp[63];
        cube[211] = cube_tmp[64];
        cube[212] = cube_tmp[65];
        cube[213] = cube_tmp[66];
        cube[214] = cube_tmp[67];
        cube[215] = cube_tmp[68];
        cube[216] = cube_tmp[69];
        cube[217] = cube_tmp[70];
        cube[218] = cube_tmp[71];
        cube[219] = cube_tmp[72];
        cube[220] = cube_tmp[73];
        cube[221] = cube_tmp[74];
        cube[222] = cube_tmp[75];
        cube[223] = cube_tmp[76];
        cube[224] = cube_tmp[77];
        cube[225] = cube_tmp[78];
        cube[226] = cube_tmp[79];
        cube[227] = cube_tmp[80];
        cube[228] = cube_tmp[81];
        cube[229] = cube_tmp[82];
        cube[230] = cube_tmp[83];
        cube[231] = cube_tmp[84];
        cube[232] = cube_tmp[85];
        cube[233] = cube_tmp[86];
        cube[234] = cube_tmp[87];
        cube[235] = cube_tmp[88];
        cube[236] = cube_tmp[89];
        cube[237] = cube_tmp[90];
        cube[238] = cube_tmp[91];
        cube[239] = cube_tmp[92];
        cube[240] = cube_tmp[93];
        cube[241] = cube_tmp[94];
        cube[242] = cube_tmp[95];
        cube[243] = cube_tmp[96];
        cube[244] = cube_tmp[97];
        cube[245] = cube_tmp[98];
        cube[246] = cube_tmp[252];
        cube[247] = cube_tmp[259];
        cube[248] = cube_tmp[266];
        cube[249] = cube_tmp[273];
        cube[250] = cube_tmp[280];
        cube[251] = cube_tmp[287];
        cube[252] = cube_tmp[294];
        cube[253] = cube_tmp[251];
        cube[254] = cube_tmp[258];
        cube[255] = cube_tmp[265];
        cube[256] = cube_tmp[272];
        cube[257] = cube_tmp[279];
        cube[258] = cube_tmp[286];
        cube[259] = cube_tmp[293];
        cube[260] = cube_tmp[250];
        cube[261] = cube_tmp[257];
        cube[262] = cube_tmp[264];
        cube[263] = cube_tmp[271];
        cube[264] = cube_tmp[278];
        cube[265] = cube_tmp[285];
        cube[266] = cube_tmp[292];
        cube[267] = cube_tmp[249];
        cube[268] = cube_tmp[256];
        cube[269] = cube_tmp[263];
        cube[271] = cube_tmp[277];
        cube[272] = cube_tmp[284];
        cube[273] = cube_tmp[291];
        cube[274] = cube_tmp[248];
        cube[275] = cube_tmp[255];
        cube[276] = cube_tmp[262];
        cube[277] = cube_tmp[269];
        cube[278] = cube_tmp[276];
        cube[279] = cube_tmp[283];
        cube[280] = cube_tmp[290];
        cube[281] = cube_tmp[247];
        cube[282] = cube_tmp[254];
        cube[283] = cube_tmp[261];
        cube[284] = cube_tmp[268];
        cube[285] = cube_tmp[275];
        cube[286] = cube_tmp[282];
        cube[287] = cube_tmp[289];
        cube[288] = cube_tmp[246];
        cube[289] = cube_tmp[253];
        cube[290] = cube_tmp[260];
        cube[291] = cube_tmp[267];
        cube[292] = cube_tmp[274];
        cube[293] = cube_tmp[281];
        cube[294] = cube_tmp[288];
        break;

    case Y_PRIME:
        cube[1] = cube_tmp[7];
        cube[2] = cube_tmp[14];
        cube[3] = cube_tmp[21];
        cube[4] = cube_tmp[28];
        cube[5] = cube_tmp[35];
        cube[6] = cube_tmp[42];
        cube[7] = cube_tmp[49];
        cube[8] = cube_tmp[6];
        cube[9] = cube_tmp[13];
        cube[10] = cube_tmp[20];
        cube[11] = cube_tmp[27];
        cube[12] = cube_tmp[34];
        cube[13] = cube_tmp[41];
        cube[14] = cube_tmp[48];
        cube[15] = cube_tmp[5];
        cube[16] = cube_tmp[12];
        cube[17] = cube_tmp[19];
        cube[18] = cube_tmp[26];
        cube[19] = cube_tmp[33];
        cube[20] = cube_tmp[40];
        cube[21] = cube_tmp[47];
        cube[22] = cube_tmp[4];
        cube[23] = cube_tmp[11];
        cube[24] = cube_tmp[18];
        cube[26] = cube_tmp[32];
        cube[27] = cube_tmp[39];
        cube[28] = cube_tmp[46];
        cube[29] = cube_tmp[3];
        cube[30] = cube_tmp[10];
        cube[31] = cube_tmp[17];
        cube[32] = cube_tmp[24];
        cube[33] = cube_tmp[31];
        cube[34] = cube_tmp[38];
        cube[35] = cube_tmp[45];
        cube[36] = cube_tmp[2];
        cube[37] = cube_tmp[9];
        cube[38] = cube_tmp[16];
        cube[39] = cube_tmp[23];
        cube[40] = cube_tmp[30];
        cube[41] = cube_tmp[37];
        cube[42] = cube_tmp[44];
        cube[43] = cube_tmp[1];
        cube[44] = cube_tmp[8];
        cube[45] = cube_tmp[15];
        cube[46] = cube_tmp[22];
        cube[47] = cube_tmp[29];
        cube[48] = cube_tmp[36];
        cube[49] = cube_tmp[43];
        cube[50] = cube_tmp[197];
        cube[51] = cube_tmp[198];
        cube[52] = cube_tmp[199];
        cube[53] = cube_tmp[200];
        cube[54] = cube_tmp[201];
        cube[55] = cube_tmp[202];
        cube[56] = cube_tmp[203];
        cube[57] = cube_tmp[204];
        cube[58] = cube_tmp[205];
        cube[59] = cube_tmp[206];
        cube[60] = cube_tmp[207];
        cube[61] = cube_tmp[208];
        cube[62] = cube_tmp[209];
        cube[63] = cube_tmp[210];
        cube[64] = cube_tmp[211];
        cube[65] = cube_tmp[212];
        cube[66] = cube_tmp[213];
        cube[67] = cube_tmp[214];
        cube[68] = cube_tmp[215];
        cube[69] = cube_tmp[216];
        cube[70] = cube_tmp[217];
        cube[71] = cube_tmp[218];
        cube[72] = cube_tmp[219];
        cube[73] = cube_tmp[220];
        cube[74] = cube_tmp[221];
        cube[75] = cube_tmp[222];
        cube[76] = cube_tmp[223];
        cube[77] = cube_tmp[224];
        cube[78] = cube_tmp[225];
        cube[79] = cube_tmp[226];
        cube[80] = cube_tmp[227];
        cube[81] = cube_tmp[228];
        cube[82] = cube_tmp[229];
        cube[83] = cube_tmp[230];
        cube[84] = cube_tmp[231];
        cube[85] = cube_tmp[232];
        cube[86] = cube_tmp[233];
        cube[87] = cube_tmp[234];
        cube[88] = cube_tmp[235];
        cube[89] = cube_tmp[236];
        cube[90] = cube_tmp[237];
        cube[91] = cube_tmp[238];
        cube[92] = cube_tmp[239];
        cube[93] = cube_tmp[240];
        cube[94] = cube_tmp[241];
        cube[95] = cube_tmp[242];
        cube[96] = cube_tmp[243];
        cube[97] = cube_tmp[244];
        cube[98] = cube_tmp[245];
        cube[99] = cube_tmp[50];
        cube[100] = cube_tmp[51];
        cube[101] = cube_tmp[52];
        cube[102] = cube_tmp[53];
        cube[103] = cube_tmp[54];
        cube[104] = cube_tmp[55];
        cube[105] = cube_tmp[56];
        cube[106] = cube_tmp[57];
        cube[107] = cube_tmp[58];
        cube[108] = cube_tmp[59];
        cube[109] = cube_tmp[60];
        cube[110] = cube_tmp[61];
        cube[111] = cube_tmp[62];
        cube[112] = cube_tmp[63];
        cube[113] = cube_tmp[64];
        cube[114] = cube_tmp[65];
        cube[115] = cube_tmp[66];
        cube[116] = cube_tmp[67];
        cube[117] = cube_tmp[68];
        cube[118] = cube_tmp[69];
        cube[119] = cube_tmp[70];
        cube[120] = cube_tmp[71];
        cube[121] = cube_tmp[72];
        cube[122] = cube_tmp[73];
        cube[123] = cube_tmp[74];
        cube[124] = cube_tmp[75];
        cube[125] = cube_tmp[76];
        cube[126] = cube_tmp[77];
        cube[127] = cube_tmp[78];
        cube[128] = cube_tmp[79];
        cube[129] = cube_tmp[80];
        cube[130] = cube_tmp[81];
        cube[131] = cube_tmp[82];
        cube[132] = cube_tmp[83];
        cube[133] = cube_tmp[84];
        cube[134] = cube_tmp[85];
        cube[135] = cube_tmp[86];
        cube[136] = cube_tmp[87];
        cube[137] = cube_tmp[88];
        cube[138] = cube_tmp[89];
        cube[139] = cube_tmp[90];
        cube[140] = cube_tmp[91];
        cube[141] = cube_tmp[92];
        cube[142] = cube_tmp[93];
        cube[143] = cube_tmp[94];
        cube[144] = cube_tmp[95];
        cube[145] = cube_tmp[96];
        cube[146] = cube_tmp[97];
        cube[147] = cube_tmp[98];
        cube[148] = cube_tmp[99];
        cube[149] = cube_tmp[100];
        cube[150] = cube_tmp[101];
        cube[151] = cube_tmp[102];
        cube[152] = cube_tmp[103];
        cube[153] = cube_tmp[104];
        cube[154] = cube_tmp[105];
        cube[155] = cube_tmp[106];
        cube[156] = cube_tmp[107];
        cube[157] = cube_tmp[108];
        cube[158] = cube_tmp[109];
        cube[159] = cube_tmp[110];
        cube[160] = cube_tmp[111];
        cube[161] = cube_tmp[112];
        cube[162] = cube_tmp[113];
        cube[163] = cube_tmp[114];
        cube[164] = cube_tmp[115];
        cube[165] = cube_tmp[116];
        cube[166] = cube_tmp[117];
        cube[167] = cube_tmp[118];
        cube[168] = cube_tmp[119];
        cube[169] = cube_tmp[120];
        cube[170] = cube_tmp[121];
        cube[171] = cube_tmp[122];
        cube[172] = cube_tmp[123];
        cube[173] = cube_tmp[124];
        cube[174] = cube_tmp[125];
        cube[175] = cube_tmp[126];
        cube[176] = cube_tmp[127];
        cube[177] = cube_tmp[128];
        cube[178] = cube_tmp[129];
        cube[179] = cube_tmp[130];
        cube[180] = cube_tmp[131];
        cube[181] = cube_tmp[132];
        cube[182] = cube_tmp[133];
        cube[183] = cube_tmp[134];
        cube[184] = cube_tmp[135];
        cube[185] = cube_tmp[136];
        cube[186] = cube_tmp[137];
        cube[187] = cube_tmp[138];
        cube[188] = cube_tmp[139];
        cube[189] = cube_tmp[140];
        cube[190] = cube_tmp[141];
        cube[191] = cube_tmp[142];
        cube[192] = cube_tmp[143];
        cube[193] = cube_tmp[144];
        cube[194] = cube_tmp[145];
        cube[195] = cube_tmp[146];
        cube[196] = cube_tmp[147];
        cube[197] = cube_tmp[148];
        cube[198] = cube_tmp[149];
        cube[199] = cube_tmp[150];
        cube[200] = cube_tmp[151];
        cube[201] = cube_tmp[152];
        cube[202] = cube_tmp[153];
        cube[203] = cube_tmp[154];
        cube[204] = cube_tmp[155];
        cube[205] = cube_tmp[156];
        cube[206] = cube_tmp[157];
        cube[207] = cube_tmp[158];
        cube[208] = cube_tmp[159];
        cube[209] = cube_tmp[160];
        cube[210] = cube_tmp[161];
        cube[211] = cube_tmp[162];
        cube[212] = cube_tmp[163];
        cube[213] = cube_tmp[164];
        cube[214] = cube_tmp[165];
        cube[215] = cube_tmp[166];
        cube[216] = cube_tmp[167];
        cube[217] = cube_tmp[168];
        cube[218] = cube_tmp[169];
        cube[219] = cube_tmp[170];
        cube[220] = cube_tmp[171];
        cube[221] = cube_tmp[172];
        cube[222] = cube_tmp[173];
        cube[223] = cube_tmp[174];
        cube[224] = cube_tmp[175];
        cube[225] = cube_tmp[176];
        cube[226] = cube_tmp[177];
        cube[227] = cube_tmp[178];
        cube[228] = cube_tmp[179];
        cube[229] = cube_tmp[180];
        cube[230] = cube_tmp[181];
        cube[231] = cube_tmp[182];
        cube[232] = cube_tmp[183];
        cube[233] = cube_tmp[184];
        cube[234] = cube_tmp[185];
        cube[235] = cube_tmp[186];
        cube[236] = cube_tmp[187];
        cube[237] = cube_tmp[188];
        cube[238] = cube_tmp[189];
        cube[239] = cube_tmp[190];
        cube[240] = cube_tmp[191];
        cube[241] = cube_tmp[192];
        cube[242] = cube_tmp[193];
        cube[243] = cube_tmp[194];
        cube[244] = cube_tmp[195];
        cube[245] = cube_tmp[196];
        cube[246] = cube_tmp[288];
        cube[247] = cube_tmp[281];
        cube[248] = cube_tmp[274];
        cube[249] = cube_tmp[267];
        cube[250] = cube_tmp[260];
        cube[251] = cube_tmp[253];
        cube[252] = cube_tmp[246];
        cube[253] = cube_tmp[289];
        cube[254] = cube_tmp[282];
        cube[255] = cube_tmp[275];
        cube[256] = cube_tmp[268];
        cube[257] = cube_tmp[261];
        cube[258] = cube_tmp[254];
        cube[259] = cube_tmp[247];
        cube[260] = cube_tmp[290];
        cube[261] = cube_tmp[283];
        cube[262] = cube_tmp[276];
        cube[263] = cube_tmp[269];
        cube[264] = cube_tmp[262];
        cube[265] = cube_tmp[255];
        cube[266] = cube_tmp[248];
        cube[267] = cube_tmp[291];
        cube[268] = cube_tmp[284];
        cube[269] = cube_tmp[277];
        cube[271] = cube_tmp[263];
        cube[272] = cube_tmp[256];
        cube[273] = cube_tmp[249];
        cube[274] = cube_tmp[292];
        cube[275] = cube_tmp[285];
        cube[276] = cube_tmp[278];
        cube[277] = cube_tmp[271];
        cube[278] = cube_tmp[264];
        cube[279] = cube_tmp[257];
        cube[280] = cube_tmp[250];
        cube[281] = cube_tmp[293];
        cube[282] = cube_tmp[286];
        cube[283] = cube_tmp[279];
        cube[284] = cube_tmp[272];
        cube[285] = cube_tmp[265];
        cube[286] = cube_tmp[258];
        cube[287] = cube_tmp[251];
        cube[288] = cube_tmp[294];
        cube[289] = cube_tmp[287];
        cube[290] = cube_tmp[280];
        cube[291] = cube_tmp[273];
        cube[292] = cube_tmp[266];
        cube[293] = cube_tmp[259];
        cube[294] = cube_tmp[252];
        break;

    case Z:
        cube[1] = cube_tmp[92];
        cube[2] = cube_tmp[85];
        cube[3] = cube_tmp[78];
        cube[4] = cube_tmp[71];
        cube[5] = cube_tmp[64];
        cube[6] = cube_tmp[57];
        cube[7] = cube_tmp[50];
        cube[8] = cube_tmp[93];
        cube[9] = cube_tmp[86];
        cube[10] = cube_tmp[79];
        cube[11] = cube_tmp[72];
        cube[12] = cube_tmp[65];
        cube[13] = cube_tmp[58];
        cube[14] = cube_tmp[51];
        cube[15] = cube_tmp[94];
        cube[16] = cube_tmp[87];
        cube[17] = cube_tmp[80];
        cube[18] = cube_tmp[73];
        cube[19] = cube_tmp[66];
        cube[20] = cube_tmp[59];
        cube[21] = cube_tmp[52];
        cube[22] = cube_tmp[95];
        cube[23] = cube_tmp[88];
        cube[24] = cube_tmp[81];
        cube[25] = cube_tmp[74];
        cube[26] = cube_tmp[67];
        cube[27] = cube_tmp[60];
        cube[28] = cube_tmp[53];
        cube[29] = cube_tmp[96];
        cube[30] = cube_tmp[89];
        cube[31] = cube_tmp[82];
        cube[32] = cube_tmp[75];
        cube[33] = cube_tmp[68];
        cube[34] = cube_tmp[61];
        cube[35] = cube_tmp[54];
        cube[36] = cube_tmp[97];
        cube[37] = cube_tmp[90];
        cube[38] = cube_tmp[83];
        cube[39] = cube_tmp[76];
        cube[40] = cube_tmp[69];
        cube[41] = cube_tmp[62];
        cube[42] = cube_tmp[55];
        cube[43] = cube_tmp[98];
        cube[44] = cube_tmp[91];
        cube[45] = cube_tmp[84];
        cube[46] = cube_tmp[77];
        cube[47] = cube_tmp[70];
        cube[48] = cube_tmp[63];
        cube[49] = cube_tmp[56];
        cube[50] = cube_tmp[288];
        cube[51] = cube_tmp[281];
        cube[52] = cube_tmp[274];
        cube[53] = cube_tmp[267];
        cube[54] = cube_tmp[260];
        cube[55] = cube_tmp[253];
        cube[56] = cube_tmp[246];
        cube[57] = cube_tmp[289];
        cube[58] = cube_tmp[282];
        cube[59] = cube_tmp[275];
        cube[60] = cube_tmp[268];
        cube[61] = cube_tmp[261];
        cube[62] = cube_tmp[254];
        cube[63] = cube_tmp[247];
        cube[64] = cube_tmp[290];
        cube[65] = cube_tmp[283];
        cube[66] = cube_tmp[276];
        cube[67] = cube_tmp[269];
        cube[68] = cube_tmp[262];
        cube[69] = cube_tmp[255];
        cube[70] = cube_tmp[248];
        cube[71] = cube_tmp[291];
        cube[72] = cube_tmp[284];
        cube[73] = cube_tmp[277];
        cube[74] = cube_tmp[270];
        cube[75] = cube_tmp[263];
        cube[76] = cube_tmp[256];
        cube[77] = cube_tmp[249];
        cube[78] = cube_tmp[292];
        cube[79] = cube_tmp[285];
        cube[80] = cube_tmp[278];
        cube[81] = cube_tmp[271];
        cube[82] = cube_tmp[264];
        cube[83] = cube_tmp[257];
        cube[84] = cube_tmp[250];
        cube[85] = cube_tmp[293];
        cube[86] = cube_tmp[286];
        cube[87] = cube_tmp[279];
        cube[88] = cube_tmp[272];
        cube[89] = cube_tmp[265];
        cube[90] = cube_tmp[258];
        cube[91] = cube_tmp[251];
        cube[92] = cube_tmp[294];
        cube[93] = cube_tmp[287];
        cube[94] = cube_tmp[280];
        cube[95] = cube_tmp[273];
        cube[96] = cube_tmp[266];
        cube[97] = cube_tmp[259];
        cube[98] = cube_tmp[252];
        cube[99] = cube_tmp[141];
        cube[100] = cube_tmp[134];
        cube[101] = cube_tmp[127];
        cube[102] = cube_tmp[120];
        cube[103] = cube_tmp[113];
        cube[104] = cube_tmp[106];
        cube[105] = cube_tmp[99];
        cube[106] = cube_tmp[142];
        cube[107] = cube_tmp[135];
        cube[108] = cube_tmp[128];
        cube[109] = cube_tmp[121];
        cube[110] = cube_tmp[114];
        cube[111] = cube_tmp[107];
        cube[112] = cube_tmp[100];
        cube[113] = cube_tmp[143];
        cube[114] = cube_tmp[136];
        cube[115] = cube_tmp[129];
        cube[116] = cube_tmp[122];
        cube[117] = cube_tmp[115];
        cube[118] = cube_tmp[108];
        cube[119] = cube_tmp[101];
        cube[120] = cube_tmp[144];
        cube[121] = cube_tmp[137];
        cube[122] = cube_tmp[130];
        cube[124] = cube_tmp[116];
        cube[125] = cube_tmp[109];
        cube[126] = cube_tmp[102];
        cube[127] = cube_tmp[145];
        cube[128] = cube_tmp[138];
        cube[129] = cube_tmp[131];
        cube[130] = cube_tmp[124];
        cube[131] = cube_tmp[117];
        cube[132] = cube_tmp[110];
        cube[133] = cube_tmp[103];
        cube[134] = cube_tmp[146];
        cube[135] = cube_tmp[139];
        cube[136] = cube_tmp[132];
        cube[137] = cube_tmp[125];
        cube[138] = cube_tmp[118];
        cube[139] = cube_tmp[111];
        cube[140] = cube_tmp[104];
        cube[141] = cube_tmp[147];
        cube[142] = cube_tmp[140];
        cube[143] = cube_tmp[133];
        cube[144] = cube_tmp[126];
        cube[145] = cube_tmp[119];
        cube[146] = cube_tmp[112];
        cube[147] = cube_tmp[105];
        cube[148] = cube_tmp[43];
        cube[149] = cube_tmp[36];
        cube[150] = cube_tmp[29];
        cube[151] = cube_tmp[22];
        cube[152] = cube_tmp[15];
        cube[153] = cube_tmp[8];
        cube[154] = cube_tmp[1];
        cube[155] = cube_tmp[44];
        cube[156] = cube_tmp[37];
        cube[157] = cube_tmp[30];
        cube[158] = cube_tmp[23];
        cube[159] = cube_tmp[16];
        cube[160] = cube_tmp[9];
        cube[161] = cube_tmp[2];
        cube[162] = cube_tmp[45];
        cube[163] = cube_tmp[38];
        cube[164] = cube_tmp[31];
        cube[165] = cube_tmp[24];
        cube[166] = cube_tmp[17];
        cube[167] = cube_tmp[10];
        cube[168] = cube_tmp[3];
        cube[169] = cube_tmp[46];
        cube[170] = cube_tmp[39];
        cube[171] = cube_tmp[32];
        cube[172] = cube_tmp[25];
        cube[173] = cube_tmp[18];
        cube[174] = cube_tmp[11];
        cube[175] = cube_tmp[4];
        cube[176] = cube_tmp[47];
        cube[177] = cube_tmp[40];
        cube[178] = cube_tmp[33];
        cube[179] = cube_tmp[26];
        cube[180] = cube_tmp[19];
        cube[181] = cube_tmp[12];
        cube[182] = cube_tmp[5];
        cube[183] = cube_tmp[48];
        cube[184] = cube_tmp[41];
        cube[185] = cube_tmp[34];
        cube[186] = cube_tmp[27];
        cube[187] = cube_tmp[20];
        cube[188] = cube_tmp[13];
        cube[189] = cube_tmp[6];
        cube[190] = cube_tmp[49];
        cube[191] = cube_tmp[42];
        cube[192] = cube_tmp[35];
        cube[193] = cube_tmp[28];
        cube[194] = cube_tmp[21];
        cube[195] = cube_tmp[14];
        cube[196] = cube_tmp[7];
        cube[197] = cube_tmp[203];
        cube[198] = cube_tmp[210];
        cube[199] = cube_tmp[217];
        cube[200] = cube_tmp[224];
        cube[201] = cube_tmp[231];
        cube[202] = cube_tmp[238];
        cube[203] = cube_tmp[245];
        cube[204] = cube_tmp[202];
        cube[205] = cube_tmp[209];
        cube[206] = cube_tmp[216];
        cube[207] = cube_tmp[223];
        cube[208] = cube_tmp[230];
        cube[209] = cube_tmp[237];
        cube[210] = cube_tmp[244];
        cube[211] = cube_tmp[201];
        cube[212] = cube_tmp[208];
        cube[213] = cube_tmp[215];
        cube[214] = cube_tmp[222];
        cube[215] = cube_tmp[229];
        cube[216] = cube_tmp[236];
        cube[217] = cube_tmp[243];
        cube[218] = cube_tmp[200];
        cube[219] = cube_tmp[207];
        cube[220] = cube_tmp[214];
        cube[222] = cube_tmp[228];
        cube[223] = cube_tmp[235];
        cube[224] = cube_tmp[242];
        cube[225] = cube_tmp[199];
        cube[226] = cube_tmp[206];
        cube[227] = cube_tmp[213];
        cube[228] = cube_tmp[220];
        cube[229] = cube_tmp[227];
        cube[230] = cube_tmp[234];
        cube[231] = cube_tmp[241];
        cube[232] = cube_tmp[198];
        cube[233] = cube_tmp[205];
        cube[234] = cube_tmp[212];
        cube[235] = cube_tmp[219];
        cube[236] = cube_tmp[226];
        cube[237] = cube_tmp[233];
        cube[238] = cube_tmp[240];
        cube[239] = cube_tmp[197];
        cube[240] = cube_tmp[204];
        cube[241] = cube_tmp[211];
        cube[242] = cube_tmp[218];
        cube[243] = cube_tmp[225];
        cube[244] = cube_tmp[232];
        cube[245] = cube_tmp[239];
        cube[246] = cube_tmp[190];
        cube[247] = cube_tmp[183];
        cube[248] = cube_tmp[176];
        cube[249] = cube_tmp[169];
        cube[250] = cube_tmp[162];
        cube[251] = cube_tmp[155];
        cube[252] = cube_tmp[148];
        cube[253] = cube_tmp[191];
        cube[254] = cube_tmp[184];
        cube[255] = cube_tmp[177];
        cube[256] = cube_tmp[170];
        cube[257] = cube_tmp[163];
        cube[258] = cube_tmp[156];
        cube[259] = cube_tmp[149];
        cube[260] = cube_tmp[192];
        cube[261] = cube_tmp[185];
        cube[262] = cube_tmp[178];
        cube[263] = cube_tmp[171];
        cube[264] = cube_tmp[164];
        cube[265] = cube_tmp[157];
        cube[266] = cube_tmp[150];
        cube[267] = cube_tmp[193];
        cube[268] = cube_tmp[186];
        cube[269] = cube_tmp[179];
        cube[270] = cube_tmp[172];
        cube[271] = cube_tmp[165];
        cube[272] = cube_tmp[158];
        cube[273] = cube_tmp[151];
        cube[274] = cube_tmp[194];
        cube[275] = cube_tmp[187];
        cube[276] = cube_tmp[180];
        cube[277] = cube_tmp[173];
        cube[278] = cube_tmp[166];
        cube[279] = cube_tmp[159];
        cube[280] = cube_tmp[152];
        cube[281] = cube_tmp[195];
        cube[282] = cube_tmp[188];
        cube[283] = cube_tmp[181];
        cube[284] = cube_tmp[174];
        cube[285] = cube_tmp[167];
        cube[286] = cube_tmp[160];
        cube[287] = cube_tmp[153];
        cube[288] = cube_tmp[196];
        cube[289] = cube_tmp[189];
        cube[290] = cube_tmp[182];
        cube[291] = cube_tmp[175];
        cube[292] = cube_tmp[168];
        cube[293] = cube_tmp[161];
        cube[294] = cube_tmp[154];
        break;

    case Z_PRIME:
        cube[1] = cube_tmp[154];
        cube[2] = cube_tmp[161];
        cube[3] = cube_tmp[168];
        cube[4] = cube_tmp[175];
        cube[5] = cube_tmp[182];
        cube[6] = cube_tmp[189];
        cube[7] = cube_tmp[196];
        cube[8] = cube_tmp[153];
        cube[9] = cube_tmp[160];
        cube[10] = cube_tmp[167];
        cube[11] = cube_tmp[174];
        cube[12] = cube_tmp[181];
        cube[13] = cube_tmp[188];
        cube[14] = cube_tmp[195];
        cube[15] = cube_tmp[152];
        cube[16] = cube_tmp[159];
        cube[17] = cube_tmp[166];
        cube[18] = cube_tmp[173];
        cube[19] = cube_tmp[180];
        cube[20] = cube_tmp[187];
        cube[21] = cube_tmp[194];
        cube[22] = cube_tmp[151];
        cube[23] = cube_tmp[158];
        cube[24] = cube_tmp[165];
        cube[25] = cube_tmp[172];
        cube[26] = cube_tmp[179];
        cube[27] = cube_tmp[186];
        cube[28] = cube_tmp[193];
        cube[29] = cube_tmp[150];
        cube[30] = cube_tmp[157];
        cube[31] = cube_tmp[164];
        cube[32] = cube_tmp[171];
        cube[33] = cube_tmp[178];
        cube[34] = cube_tmp[185];
        cube[35] = cube_tmp[192];
        cube[36] = cube_tmp[149];
        cube[37] = cube_tmp[156];
        cube[38] = cube_tmp[163];
        cube[39] = cube_tmp[170];
        cube[40] = cube_tmp[177];
        cube[41] = cube_tmp[184];
        cube[42] = cube_tmp[191];
        cube[43] = cube_tmp[148];
        cube[44] = cube_tmp[155];
        cube[45] = cube_tmp[162];
        cube[46] = cube_tmp[169];
        cube[47] = cube_tmp[176];
        cube[48] = cube_tmp[183];
        cube[49] = cube_tmp[190];
        cube[50] = cube_tmp[7];
        cube[51] = cube_tmp[14];
        cube[52] = cube_tmp[21];
        cube[53] = cube_tmp[28];
        cube[54] = cube_tmp[35];
        cube[55] = cube_tmp[42];
        cube[56] = cube_tmp[49];
        cube[57] = cube_tmp[6];
        cube[58] = cube_tmp[13];
        cube[59] = cube_tmp[20];
        cube[60] = cube_tmp[27];
        cube[61] = cube_tmp[34];
        cube[62] = cube_tmp[41];
        cube[63] = cube_tmp[48];
        cube[64] = cube_tmp[5];
        cube[65] = cube_tmp[12];
        cube[66] = cube_tmp[19];
        cube[67] = cube_tmp[26];
        cube[68] = cube_tmp[33];
        cube[69] = cube_tmp[40];
        cube[70] = cube_tmp[47];
        cube[71] = cube_tmp[4];
        cube[72] = cube_tmp[11];
        cube[73] = cube_tmp[18];
        cube[74] = cube_tmp[25];
        cube[75] = cube_tmp[32];
        cube[76] = cube_tmp[39];
        cube[77] = cube_tmp[46];
        cube[78] = cube_tmp[3];
        cube[79] = cube_tmp[10];
        cube[80] = cube_tmp[17];
        cube[81] = cube_tmp[24];
        cube[82] = cube_tmp[31];
        cube[83] = cube_tmp[38];
        cube[84] = cube_tmp[45];
        cube[85] = cube_tmp[2];
        cube[86] = cube_tmp[9];
        cube[87] = cube_tmp[16];
        cube[88] = cube_tmp[23];
        cube[89] = cube_tmp[30];
        cube[90] = cube_tmp[37];
        cube[91] = cube_tmp[44];
        cube[92] = cube_tmp[1];
        cube[93] = cube_tmp[8];
        cube[94] = cube_tmp[15];
        cube[95] = cube_tmp[22];
        cube[96] = cube_tmp[29];
        cube[97] = cube_tmp[36];
        cube[98] = cube_tmp[43];
        cube[99] = cube_tmp[105];
        cube[100] = cube_tmp[112];
        cube[101] = cube_tmp[119];
        cube[102] = cube_tmp[126];
        cube[103] = cube_tmp[133];
        cube[104] = cube_tmp[140];
        cube[105] = cube_tmp[147];
        cube[106] = cube_tmp[104];
        cube[107] = cube_tmp[111];
        cube[108] = cube_tmp[118];
        cube[109] = cube_tmp[125];
        cube[110] = cube_tmp[132];
        cube[111] = cube_tmp[139];
        cube[112] = cube_tmp[146];
        cube[113] = cube_tmp[103];
        cube[114] = cube_tmp[110];
        cube[115] = cube_tmp[117];
        cube[116] = cube_tmp[124];
        cube[117] = cube_tmp[131];
        cube[118] = cube_tmp[138];
        cube[119] = cube_tmp[145];
        cube[120] = cube_tmp[102];
        cube[121] = cube_tmp[109];
        cube[122] = cube_tmp[116];
        cube[124] = cube_tmp[130];
        cube[125] = cube_tmp[137];
        cube[126] = cube_tmp[144];
        cube[127] = cube_tmp[101];
        cube[128] = cube_tmp[108];
        cube[129] = cube_tmp[115];
        cube[130] = cube_tmp[122];
        cube[131] = cube_tmp[129];
        cube[132] = cube_tmp[136];
        cube[133] = cube_tmp[143];
        cube[134] = cube_tmp[100];
        cube[135] = cube_tmp[107];
        cube[136] = cube_tmp[114];
        cube[137] = cube_tmp[121];
        cube[138] = cube_tmp[128];
        cube[139] = cube_tmp[135];
        cube[140] = cube_tmp[142];
        cube[141] = cube_tmp[99];
        cube[142] = cube_tmp[106];
        cube[143] = cube_tmp[113];
        cube[144] = cube_tmp[120];
        cube[145] = cube_tmp[127];
        cube[146] = cube_tmp[134];
        cube[147] = cube_tmp[141];
        cube[148] = cube_tmp[252];
        cube[149] = cube_tmp[259];
        cube[150] = cube_tmp[266];
        cube[151] = cube_tmp[273];
        cube[152] = cube_tmp[280];
        cube[153] = cube_tmp[287];
        cube[154] = cube_tmp[294];
        cube[155] = cube_tmp[251];
        cube[156] = cube_tmp[258];
        cube[157] = cube_tmp[265];
        cube[158] = cube_tmp[272];
        cube[159] = cube_tmp[279];
        cube[160] = cube_tmp[286];
        cube[161] = cube_tmp[293];
        cube[162] = cube_tmp[250];
        cube[163] = cube_tmp[257];
        cube[164] = cube_tmp[264];
        cube[165] = cube_tmp[271];
        cube[166] = cube_tmp[278];
        cube[167] = cube_tmp[285];
        cube[168] = cube_tmp[292];
        cube[169] = cube_tmp[249];
        cube[170] = cube_tmp[256];
        cube[171] = cube_tmp[263];
        cube[172] = cube_tmp[270];
        cube[173] = cube_tmp[277];
        cube[174] = cube_tmp[284];
        cube[175] = cube_tmp[291];
        cube[176] = cube_tmp[248];
        cube[177] = cube_tmp[255];
        cube[178] = cube_tmp[262];
        cube[179] = cube_tmp[269];
        cube[180] = cube_tmp[276];
        cube[181] = cube_tmp[283];
        cube[182] = cube_tmp[290];
        cube[183] = cube_tmp[247];
        cube[184] = cube_tmp[254];
        cube[185] = cube_tmp[261];
        cube[186] = cube_tmp[268];
        cube[187] = cube_tmp[275];
        cube[188] = cube_tmp[282];
        cube[189] = cube_tmp[289];
        cube[190] = cube_tmp[246];
        cube[191] = cube_tmp[253];
        cube[192] = cube_tmp[260];
        cube[193] = cube_tmp[267];
        cube[194] = cube_tmp[274];
        cube[195] = cube_tmp[281];
        cube[196] = cube_tmp[288];
        cube[197] = cube_tmp[239];
        cube[198] = cube_tmp[232];
        cube[199] = cube_tmp[225];
        cube[200] = cube_tmp[218];
        cube[201] = cube_tmp[211];
        cube[202] = cube_tmp[204];
        cube[203] = cube_tmp[197];
        cube[204] = cube_tmp[240];
        cube[205] = cube_tmp[233];
        cube[206] = cube_tmp[226];
        cube[207] = cube_tmp[219];
        cube[208] = cube_tmp[212];
        cube[209] = cube_tmp[205];
        cube[210] = cube_tmp[198];
        cube[211] = cube_tmp[241];
        cube[212] = cube_tmp[234];
        cube[213] = cube_tmp[227];
        cube[214] = cube_tmp[220];
        cube[215] = cube_tmp[213];
        cube[216] = cube_tmp[206];
        cube[217] = cube_tmp[199];
        cube[218] = cube_tmp[242];
        cube[219] = cube_tmp[235];
        cube[220] = cube_tmp[228];
        cube[222] = cube_tmp[214];
        cube[223] = cube_tmp[207];
        cube[224] = cube_tmp[200];
        cube[225] = cube_tmp[243];
        cube[226] = cube_tmp[236];
        cube[227] = cube_tmp[229];
        cube[228] = cube_tmp[222];
        cube[229] = cube_tmp[215];
        cube[230] = cube_tmp[208];
        cube[231] = cube_tmp[201];
        cube[232] = cube_tmp[244];
        cube[233] = cube_tmp[237];
        cube[234] = cube_tmp[230];
        cube[235] = cube_tmp[223];
        cube[236] = cube_tmp[216];
        cube[237] = cube_tmp[209];
        cube[238] = cube_tmp[202];
        cube[239] = cube_tmp[245];
        cube[240] = cube_tmp[238];
        cube[241] = cube_tmp[231];
        cube[242] = cube_tmp[224];
        cube[243] = cube_tmp[217];
        cube[244] = cube_tmp[210];
        cube[245] = cube_tmp[203];
        cube[246] = cube_tmp[56];
        cube[247] = cube_tmp[63];
        cube[248] = cube_tmp[70];
        cube[249] = cube_tmp[77];
        cube[250] = cube_tmp[84];
        cube[251] = cube_tmp[91];
        cube[252] = cube_tmp[98];
        cube[253] = cube_tmp[55];
        cube[254] = cube_tmp[62];
        cube[255] = cube_tmp[69];
        cube[256] = cube_tmp[76];
        cube[257] = cube_tmp[83];
        cube[258] = cube_tmp[90];
        cube[259] = cube_tmp[97];
        cube[260] = cube_tmp[54];
        cube[261] = cube_tmp[61];
        cube[262] = cube_tmp[68];
        cube[263] = cube_tmp[75];
        cube[264] = cube_tmp[82];
        cube[265] = cube_tmp[89];
        cube[266] = cube_tmp[96];
        cube[267] = cube_tmp[53];
        cube[268] = cube_tmp[60];
        cube[269] = cube_tmp[67];
        cube[270] = cube_tmp[74];
        cube[271] = cube_tmp[81];
        cube[272] = cube_tmp[88];
        cube[273] = cube_tmp[95];
        cube[274] = cube_tmp[52];
        cube[275] = cube_tmp[59];
        cube[276] = cube_tmp[66];
        cube[277] = cube_tmp[73];
        cube[278] = cube_tmp[80];
        cube[279] = cube_tmp[87];
        cube[280] = cube_tmp[94];
        cube[281] = cube_tmp[51];
        cube[282] = cube_tmp[58];
        cube[283] = cube_tmp[65];
        cube[284] = cube_tmp[72];
        cube[285] = cube_tmp[79];
        cube[286] = cube_tmp[86];
        cube[287] = cube_tmp[93];
        cube[288] = cube_tmp[50];
        cube[289] = cube_tmp[57];
        cube[290] = cube_tmp[64];
        cube[291] = cube_tmp[71];
        cube[292] = cube_tmp[78];
        cube[293] = cube_tmp[85];
        cube[294] = cube_tmp[92];
        break;


    default:
        printf("ERROR: invalid move %d\n", move);
        exit(1);
    }
}

